<![CDATA[Add to Twenty Game SLS version 20200420]]> false true true false ]]> ./racetotwenty/Screenshot 2020-04-20 at 5.14.29 PM.png ./1authorlookangphoto5050.png;./01authorPacoEsquembre2011.png;./01authorFelix_J_Garcia_Clemente.png; 20 1 false VARIABLE_EDITOR Var Table true false VARIABLE_EDITOR player1 true false VARIABLE_EDITOR game true false VARIABLE_EDITOR oddeven true false VARIABLE_EDITOR animate true false VARIABLE_EDITOR AI true false VARIABLE_EDITOR fakeplayer12 true false CODE_EDITOR svg true false '+ ' '+ ' '+ ' '+ ' '+ ''; container.innerHTML = svggradient; document.body.appendChild(container); var container = document.createElement('div'); var svggradient = ''+ ' '+ ' '+ ' '+ ' '+ ''; container.innerHTML = svggradient; document.body.appendChild(container); //"url(#mygrandient1)" var container = document.createElement('div'); var svggradient = ''+ ' '+ ' '+ ' '+ ' '+ ''; container.innerHTML = svggradient; document.body.appendChild(container); //"url(#mygrandient2)" ]]> CODE_EDITOR undefined true false CODE_EDITOR setupcells true false CODE_EDITOR setuptextongamecards true false CODE_EDITOR challeng1 true false ODE_EDITOR Evol Page true false EVENT_EDITOR Event true false CROSSING_EVENT BISECTION 100 true EVENT_EDITOR Event 2 true false CROSSING_EVENT BISECTION 100 true t dt counttotal%2==1?(xgame[counttotal-1]-xcell[objectinteracted]):(xgame[counttotal-1]-xcell2[objectinteracted2]) counttotal%2==1?(ygame[counttotal-1]-player1y):(ygame[counttotal-1]-player2y) Euler 10000 0.00001 false false false false CODE_EDITOR lockcell true false CODE_EDITOR score false false end){ message= "game over!, you lose by exceeding "+end; // alert("game over!, you lose by exceeding "+end); } ]]> CODE_EDITOR score 2 true false end){ if (counttotal%2==0){ EJSS_INTERFACE.BoxPanel.showOkDialog("Game over! "+player2color+" lose by exceeding "+end+"."); } else if (counttotal%2==1){ EJSS_INTERFACE.BoxPanel.showOkDialog("Game over! "+player1color+" lose by exceeding "+end+"."); } // alert("game over!, you lose by exceeding "+end); // EJSS_INTERFACE.BoxPanel.showOkDialog("game over!, you lose by exceeding "+end); } } ]]> CODE_EDITOR score 2player2 start true false end){ if (counttotal%2==0){ EJSS_INTERFACE.BoxPanel.showOkDialog("Game over! "+player2color+" lose by exceeding "+end+"."); } else if (counttotal%2==1){ EJSS_INTERFACE.BoxPanel.showOkDialog("Game over! "+player1color+" lose by exceeding "+end+"."); } // alert("game over!, you lose by exceeding "+end); // EJSS_INTERFACE.BoxPanel.showOkDialog("game over!, you lose by exceeding "+end); } } ]]> CODE_EDITOR AI true false =(end-1*(n+1)+1)){ //19 to 15 // code block move[0]= end-score; move2 = move[0]; hinttext ="players should use this card = "+move2; } else if (score <=end-1*(n+1)-1&&score >=end-2*(n+1)+1){ //13 to 9 move[1] = end-1*(n+1)-score; move2 = move[1]; hinttext ="players should use this card = "+move2; } else if (score<= end-2*(n+1)-1&&score >=end-3*(n+1)+1){ //7 to 3 move[2] = end-2*(n+1)-score; move2 = move[2]; hinttext ="players should use this card = "+move2; } else if( score <=end-3*(n+1)-1&&score >=end-4*(n+1)+1){ //1 move[3] = end-3*(n+1)-score; move2 = move[3]; hinttext ="players should use this card = "+move2; } else{ // move[0]=Math.ceil(Math.random()*5); move2= stepAI; hinttext = "players should move to land on these sums="+move2; //objectinteracted2=move2-1; } // code block } ]]> CODE_EDITOR hintext true false LIBRARY_EDITOR changeOrientation true false LIBRARY_EDITOR fullscreen true false LIBRARY_EDITOR texttospeech true false LIBRARY_EDITOR normal true false LIBRARY_EDITOR setupcells true false LIBRARY_EDITOR p1even true false LIBRARY_EDITOR p1odd true false LIBRARY_EDITOR p2even true false LIBRARY_EDITOR p2odd true false HTML_VIEW_EDITOR HtmlView Page true false true Elements.Panel true Elements.Panel Elements.Label Elements.ComboBox 0)? opts[0]:""; // selected option //_initialize(); //"challenge 1","challenge 2","challenge 3","challenge 4" if ( option=="Blue"){ player1start=true; show1 = false; player1y = 7; player2y = -7; player1color="Blue"; player2color="Red"; } else if ( option=="Red"){ player1start=false; show1=true; player1y = -7; //swap position player2y = 7; //player1yword=3; //player2yword=-3; player1color="Red"; player2color="Blue"; } ]]> Elements.ComboBox 0)? opts[0]:""; // selected option //_initialize(); //"challenge 1","challenge 2","challenge 3","challenge 4" if ( option=="Blue Player"){ player1start=true; player1y = 7; player2y = -7; //player1yword=-3; //player2yword=3; } else if ( option=="Red Player"){ player1start=false; player1y = -7; player2y = 7; //player1yword=3; //player2yword=-3; } ]]> Elements.ComboBox 0)? opts[0]:""; // selected option //_initialize(); //"challenge 1","challenge 2","challenge 3","challenge 4" if ( option=="challenge 1 target=20"){ n=ns=5; //number store n number of cards start=0; end=20; setupcells (); normal(); userdefined=false; } if ( option=="challenge 3 target=25"){ n=ns=8; //number store n number of cards start=0; end=25; setupcells (); normal(); userdefined=false; } if ( option=="challenge 2 target=20"){ n=ns=8; //number store n number of cards start=0; end=20; setupcells (); normal(); userdefined=false; } if ( option=="Why is Player BLUE a sure winner?"){ n=ns=11; //number store n number of cards start=0; end=20; setupcells (); normal(); userdefined=true; _tools.showOkDialog("Player BLUE, please choose 8"); //p2even(); // p1even(); } if ( option=="Why is Player RED a sure winner?"){ n=ns=9; //number store n number of cards start=0; end=20; setupcells (); //p2even(); // p1even(); userdefined=true; _tools.showOkDialog("Player BLUE please choose any number, but Player 2 must add to 10"); } if ( option=="Set your own challenge!"){ userdefined=true; } else if ( option=="normal"){ normal (); } else if ( option=="PlayerBLUE even"){ p1even(); } else if ( option=="PlayerBLUE odd"){ p1odd(); } else if ( option=="PlayerRED even"){ p2even(); } else if ( option=="PlayerRED odd"){ p2odd(); } //"show score","hide score" else if ( option=="show score"){ showscore=true; } else if ( option=="hide score"){ showscore=false; } //texttospeech(option); feedbacktext= _view.comboBox.getProperty("SelectedOptions")+" ,start= "+ start +" ,target= "+end; ]]> Elements.CheckBox 0]]> Elements.CheckBox 0]]> Elements.Button true Elements.Panel Elements.Label Elements.ParsedField end){ start = 0; //alert("start cannot be bigger than end"); _tools.showOkDialog("start cannot be bigger than end"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } if (start<0) { // alert( "start cannot be lesser than zero"); _tools.showOkDialog("start cannot be lesser than zero"); document.getElementById(".myBoxPanelOk").style.top = "0px"; start=Math.max(n,0); } ]]> Elements.Label Elements.ParsedField 100){ end = 100; // alert("end cannot be greater than 100"); _tools.showOkDialog("end cannot be greater than 100"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } ]]> Elements.Label Elements.ParsedField 13) { // alert( "maximum number of cards limited to 13"); _tools.showOkDialog("maximum number of cards limited to 13"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } n=Math.min(n,13); if (n<2) { //alert( "minimum number of cards limited to 2"); _tools.showOkDialog("minimum number of cards limited to 2"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } n=Math.max(n,2); ns=n; // for memory for (var i=0;i true Elements.PlottingPanel Elements.Text2D true Elements.Group2D true Elements.Group2D Elements.ShapeSet2D Elements.ShapeSet2D 1){//check player 2 turn if (counttotal%2==1){//check player 2 turn //count = count-1; // alert("player 1 : 1"); _tools.showOkDialog("The other player’s turn"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } else if (counttotal%2==0){ //alert("player 1 : 2"); //animate xanimate= xcell[objectinteracted]; yanimate= player1y; _play(); count = count+1; counttotal=count+count2; score=score+objectinteracted+1; //count = count+1; //old colorscheme //gamecolor[counttotal-1]= colorplayer1[objectinteracted]; gamecolor[counttotal-1]= colorplayer1[objectinteracted]; textgame[counttotal-1]= text[objectinteracted]; textwordsgame[counttotal-1]=textwords[objectinteracted]; } /* else if (counttotal%2==1&&player1start==false){//check player 2 turn //count = count-1; //alert("player 2 turn"); _tools.showOkDialog("player RED turn"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } else if (counttotal%2==0&&player1start==false){ count = count+1; counttotal=count+count2; score=score+objectinteracted+1; //count = count+1; //old colorscheme //gamecolor[counttotal-1]= colorplayer1[objectinteracted]; gamecolor[counttotal-1]= colorplayer1[objectinteracted]; textgame[counttotal-1]= text[objectinteracted]; textwordsgame[counttotal-1]=textwords[objectinteracted]; } */]]> true Elements.Group2D Elements.ShapeSet2D Elements.ShapeSet2D 1){//check player 2 turn if (counttotal%2==1){//check player 2 turn //count = count-1; // alert("player 1 : 1"); // _tools.showOkDialog("player RED turn"); _tools.showOkDialog("The other player’s turn"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } else if (counttotal%2==0){ //alert("player 1 : 2"); //animate xanimate= xcell[objectinteracted]; yanimate= player1y; _play(); count = count+1; counttotal=count+count2; score=score+objectinteracted+1; //count = count+1; //old colorscheme //gamecolor[counttotal-1]= colorplayer1[objectinteracted]; gamecolor[counttotal-1]= colorplayer2[objectinteracted]; //change color to red textgame[counttotal-1]= text[objectinteracted]; textwordsgame[counttotal-1]=textwords[objectinteracted]; } /* else if (counttotal%2==1&&player1start==false){//check player 2 turn //count = count-1; //alert("player 2 turn"); _tools.showOkDialog("player RED turn"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } else if (counttotal%2==0&&player1start==false){ count = count+1; counttotal=count+count2; score=score+objectinteracted+1; //count = count+1; //old colorscheme //gamecolor[counttotal-1]= colorplayer1[objectinteracted]; gamecolor[counttotal-1]= colorplayer1[objectinteracted]; textgame[counttotal-1]= text[objectinteracted]; textwordsgame[counttotal-1]=textwords[objectinteracted]; } */]]> Elements.TextSet2D Elements.TextSet2D true Elements.Group2D Elements.ShapeSet2D Elements.ShapeSet2D Elements.TextSet2D Elements.TextSet2D Elements.Text2D Elements.Text2D true Elements.Group2D true Elements.Group2D Elements.ShapeSet2D Elements.ShapeSet2D 1){//check player 2 turn if (counttotal%2==0){//check player 1 turn // count2 = count2-1; //alert("player 2: 1"); _tools.showOkDialog("The other player's turn"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } else if (counttotal%2==1){ //animate xanimate= xcell2[objectinteracted2]; yanimate= player2y; _play(); //alert("player 2: 2"); count2 = count2+1; counttotal=count+count2; score=score+objectinteracted2+1; //count2=count2+1; // old color scheme //gamecolor[counttotal-1]= colorplayer2[objectinteracted2]; gamecolor[counttotal-1]= colorplayer2[objectinteracted2]; //textgame[counttotal]= text2[objectinteracted2+1]; textgame[counttotal-1]= text[objectinteracted2]; textwordsgame[counttotal-1]=textwords[objectinteracted2]; } /* else if (counttotal%2==0&&player1start==false){//check player 1 turn // count2 = count2-1; // alert("player 1 turn"); alert("3"); _tools.showOkDialog("player BLUE turn"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } else if (counttotal%2==1&&player1start==false){ alert("4"); count2 = count2+1; counttotal=count+count2; score=score+objectinteracted2+1; //count2=count2+1; // old color scheme //gamecolor[counttotal-1]= colorplayer2[objectinteracted2]; gamecolor[counttotal-1]= colorplayer2[objectinteracted2]; //textgame[counttotal]= text2[objectinteracted2+1]; textgame[counttotal-1]= text2[objectinteracted2]; textwordsgame[counttotal-1]=textwords2[objectinteracted2]; } */]]> true Elements.Group2D Elements.ShapeSet2D Elements.ShapeSet2D 1){//check player 2 turn if (counttotal%2==0){//check player 1 turn // count2 = count2-1; //alert("player 2: 1"); _tools.showOkDialog("The other player's turn"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } else if (counttotal%2==1){ //animate xanimate= xcell2[objectinteracted2]; yanimate= player2y; _play(); //alert("player 2: 2"); count2 = count2+1; counttotal=count+count2; score=score+objectinteracted2+1; //count2=count2+1; // old color scheme //gamecolor[counttotal-1]= colorplayer2[objectinteracted2]; gamecolor[counttotal-1]= colorplayer1[objectinteracted2]; //change color to blue as it is already shifed up //textgame[counttotal]= text2[objectinteracted2+1]; textgame[counttotal-1]= text[objectinteracted2]; textwordsgame[counttotal-1]=textwords[objectinteracted2]; } /* else if (counttotal%2==0&&player1start==false){//check player 1 turn // count2 = count2-1; // alert("player 1 turn"); alert("3"); _tools.showOkDialog("player BLUE turn"); document.getElementById(".myBoxPanelOk").style.top = "0px"; } else if (counttotal%2==1&&player1start==false){ alert("4"); count2 = count2+1; counttotal=count+count2; score=score+objectinteracted2+1; //count2=count2+1; // old color scheme //gamecolor[counttotal-1]= colorplayer2[objectinteracted2]; gamecolor[counttotal-1]= colorplayer2[objectinteracted2]; //textgame[counttotal]= text2[objectinteracted2+1]; textgame[counttotal-1]= text2[objectinteracted2]; textwordsgame[counttotal-1]=textwords2[objectinteracted2]; } */]]> Elements.TextSet2D Elements.TextSet2D Elements.Shape2D false Elements.Group2D Elements.Arrow2D Elements.Arrow2D true Elements.Group2D Elements.Text2D Elements.Text2D true Elements.Group2D Elements.Text2D Elements.Text2D Elements.Audio Elements.Panel About

This card game designed to help understand how to always be the first person to reach 20 by allowing students to develop their own thinking about the rules of reaching twenty.

Let assume end in the last number, say 20

Start is the beginning number say 0

largest card number is say, n = 11 for both REd and BlUE players.

The hint is to always win, you need to reach (end-start) - n -1 , which is 8 so that whatever the next move by the opponent ranging from 1 to 11, you can place your next card to reach end =20!

Another example is

Let assume end in the last number, say 20

Start is the beginning number say 0

largest card number is say, n = 5 for both REd and BlUE players.

So the AI step is = end - i*(n+1),

so stepAI[0] = 20 -0*(5+1) = 20

stepAI[1] = 20-1*(5+1) = 14

stepAI[2] = 20-2*(5+1) = 8

stepAI[3] = 20-3*(5+1) = 2

so to win, try to land on 2, followed by 8, followed by 14 and lastly to win 20!

enjoy!

Default Settings and Range

Game play can be made more challenging by varying target end number from default 20 to 40 for example.

start number from default of 0 to 10 for example

number of cards available to players, default is 11

odd numbers card only for player 1 or 2

even numbers cards only for player 1 or 2

more resources can be found here

http://iwant2study.org/ospsg/index.php/interactive-resources/mathematics

Interesting Fact

This app is created to support playing of adding up in creative and challenging ways.

Acknowledgement

This physical card game was originally shown to me and conceptualized by Theresa Heng.

My sincere gratitude for the tireless contributions of Francisco Esquembre, Fu-Kwun Hwang, Wolfgang Christian, Félix Jesús García Clemente, Anne Cox, Andrew Duffy, Todd Timberlake and many more in the Open Source Physics community.

Network Learn together?

FaceBook Fan Page: https://www.facebook.com/Open-Source-Physics-Easy-Java-Simulation-Tracker-132622246810575/

Twitter: https://twitter.com/lookang

YouTube: https://www.youtube.com/user/lookang/videos

Blog: http://weelookang.blogspot.sg/

Digital Library: http://iwant2study.org/ospsg/

]]>