'+
' '+
' '+
' '+
' '+
' ';
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)"
]]>
end){
message= "game over!, you lose by exceeding "+end;
// alert("game over!, you lose by exceeding "+end);
}
]]>
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);
}
}
]]>
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);
}
}
]]>
=(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
}
]]>
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!
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/mathematicsThis app is created to support playing of adding up in creative and challenging ways.
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.
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/
]]>