Skip to content

Instantly share code, notes, and snippets.

@sanket143
Created June 14, 2017 18:36
Show Gist options
  • Save sanket143/26132c631338a73f2574d3927ff09c2f to your computer and use it in GitHub Desktop.
Save sanket143/26132c631338a73f2574d3927ff09c2f to your computer and use it in GitHub Desktop.
You could play cricket by refreshing the code and copying whatever the result show
function Cricket() {
var Maths = Math.random() * 10 ;
Maths = Math.floor(Maths);
if (Maths ==1 ) {
return "One run";
}
else if (Maths == 2) {
return "Two runs";
}
else if (Maths == 3) {
return "Dot Ball";
}
else if (Maths == 4) {
return "4 runs";
}
else if (Maths == 5) {
return "Bowled";
}
else if (Maths == 6) {
return "Sixer";
}
else if (Maths == 7) {
return "Run Out";
}
else if (Maths == 8) {
return "Catch Out";
}
else if (Maths == 9) {
return "LBW";
}
else {
return "No ball";
}
}
Cricket();// Your each refresh will count as 1 Ball and try to note down the result as per the player in accord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment