@@ -33,7 +33,7 @@ function main(config){
3333 }
3434
3535 var initialConfig
36- var allnames = [ "systems" , "voters" , "custom_number_voters" , "group_count" , "group_spread" , "candidates" , "strategy" , "percentstrategy" , "unstrategic" , "frontrunners" , "poll" , "yee" ]
36+ var allnames = [ "systems" , "voters" , "custom_number_voters" , "group_count" , "group_spread" , "candidates" , "strategy" , "second strategy" , " percentstrategy", "unstrategic" , "frontrunners" , "poll" , "yee" ]
3737 var doms = { } // for hiding menus, later
3838 var stratsliders = [ ] // for hiding sliders, later
3939 var groupsliders = [ ] // for hiding sliders, later
@@ -68,7 +68,7 @@ function main(config){
6868 config . doPercentFirst = config . doPercentFirst || false ;
6969 if ( config . doPercentFirst ) config . featurelist = config . featurelist . concat ( [ "percentstrategy" ] ) ;
7070 config . doFullStrategyConfig = config . doFullStrategyConfig || false ;
71- if ( config . doFullStrategyConfig ) config . featurelist = config . featurelist . concat ( [ "strategy " , "percentstrategy" , "unstrategic ", "frontrunners" , "poll" , "yee" ] )
71+ if ( config . doFullStrategyConfig ) config . featurelist = config . featurelist . concat ( [ "unstrategic " , "second strategy " , "frontrunners" , "poll" , "yee" ] )
7272 // clear the grandfathered config settings
7373 config . doPercentFirst = undefined
7474 config . features = undefined
@@ -95,6 +95,7 @@ function main(config){
9595 }
9696
9797 config . unstrategic = config . unstrategic || "zero strategy. judge on an absolute scale." ;
98+ config . second_strategy = config . second_strategy || false ;
9899 config . keyyee = config . keyyee || "off" ;
99100 config . computeMethod = config . computeMethod || "ez" ;
100101 config . pixelsize = config . pixelsize || 30 ;
@@ -207,6 +208,7 @@ function main(config){
207208 group_spread : config . voter_group_spread [ i ] ,
208209 preFrontrunnerIds : config . preFrontrunnerIds ,
209210 unstrategic : config . unstrategic ,
211+ second_strategy : config . second_strategy ,
210212 vid : i ,
211213 snowman : config . snowman ,
212214 x_voters : config . x_voters ,
@@ -639,8 +641,8 @@ function main(config){
639641 // only the middle percent (for the yellow triangle)
640642
641643 // no reset...
644+ config . unstrategic = data . realname ;
642645 for ( var i = 0 ; i < model . voters . length ; i ++ ) {
643- config . unstrategic = data . realname ;
644646 model . voters [ i ] . unstrategic = config . unstrategic
645647 }
646648 model . update ( ) ;
@@ -656,6 +658,56 @@ function main(config){
656658 doms [ "unstrategic" ] = chooseVoterStrategyOff . dom
657659
658660
661+
662+
663+
664+ // Is there a 2nd strategy?
665+ var second_strategy = [
666+ { realname : "opton for 2nd strategy" , name :"+" }
667+ ] ;
668+ var onChoose_second_strategy = function ( data ) {
669+
670+ // update config and model
671+ var b = data . isOn
672+ config . second_strategy = b
673+ model . second_strategy = b
674+ for ( var i = 0 ; i < model . voters . length ; i ++ ) {
675+ model . voters [ i ] . second_strategy = b
676+ }
677+ model . update ( ) ;
678+
679+
680+ // update gui
681+ var xlist = [ "strategy" , "percentstrategy" ]
682+ var featureset = new Set ( config . featurelist )
683+ for ( var i in xlist ) {
684+ var xi = xlist [ i ]
685+ if ( data . isOn ) {
686+ featureset . add ( xi )
687+ doms [ xi ] . hidden = false
688+ } else {
689+ featureset . delete ( xi )
690+ doms [ xi ] . hidden = true
691+ }
692+ }
693+ config . featurelist = Array . from ( featureset )
694+
695+
696+
697+ } ;
698+ window . choose_second_strategy = new ButtonGroup ( {
699+ label : "" ,
700+ width : 40 ,
701+ data : second_strategy ,
702+ onChoose : onChoose_second_strategy ,
703+ isCheckbox : true
704+ } ) ;
705+ document . querySelector ( "#left" ) . appendChild ( choose_second_strategy . dom ) ;
706+ doms [ "second strategy" ] = choose_second_strategy . dom
707+
708+
709+
710+
659711
660712 // strategy
661713
@@ -1157,6 +1209,12 @@ function main(config){
11571209 }
11581210 }
11591211 if ( window . chooseVoterStrategyOff ) chooseVoterStrategyOff . highlight ( "realname" , model . voters [ 0 ] . unstrategic ) ;
1212+ if ( window . choose_second_strategy ) {
1213+ if ( config . second_strategy ) {
1214+ choose_second_strategy . highlight ( "name" , "+" ) ;
1215+ }
1216+ }
1217+
11601218 if ( window . chooseFrun ) chooseFrun . highlight ( "realname" , model . preFrontrunnerIds ) ;
11611219 if ( stratsliders ) {
11621220 for ( i in stratsliders ) {
0 commit comments