Game of 7Up

[Total: 0    Average: 0/5]

This is the clasic game of 7up.

Head Code:

body {background-color: #666; color: #840; font-weight: bold;}
#in1,#in2 {background-color: #840; color: #000; font-weight: bold; border: 1px solid #A80;}
#in0 {background-color: #000; color: #FFF; font-weight: bold; border: 1px solid #A80;}
var MESSAGE="What's your bet?n 7+, 7-, or 7=?nnPlease type any one of the three.";
var YOUR_CHOICE=new Array();
    YOUR_CHOICE["7+"]="You choose 7 up";
    YOUR_CHOICE["7-"]="You choose 7 down";
    YOUR_CHOICE["7="]="You choose 7 even";
var COMPARE=new Array();
var RESPONSES=new Array();
    RESPONSES[false]=new Array();
    RESPONSES[false]["7+"]="I win - you picked 7+.";
    RESPONSES[false]["7-"]="I win - you picked 7-.";
    RESPONSES[false]["7="]="I win - you picked 7=.";
    RESPONSES[true]=new Array();
    RESPONSES[true]["7+"]="You win - you picked 7+.";
    RESPONSES[true]["7-"]="You win - you picked 7-.";
    RESPONSES[true]["7="]="You win - you picked 7=.";
var OBJ=new Array();
function fun_7up()
  var _choice=prompt(MESSAGE);
  var _random=Math.floor(Math.random()*15);
  var _message1=YOUR_CHOICE[_choice];
    alert("ERROR: You didn't make a valid choice.nYou input""+_choice+""");
    var _test=eval(_random+COMPARE[_choice]+7)?true:false;
    var _message2="nMy number was ""+_random+"".";
    var _obj=eval(OBJ[_test]);

Body Code:

<font face="Comic Sans MS">
<font color="Orange">
Ok, I hope you know the rules.<BR />
Normally, this is a dice game.<BR />
You have three options: 7 up, 7 down and 7 equal.<BR />

Two dices are used.<BR />
If the total is below 7 and if you had bet for 7 down, you win.<BR />
Same for others...<BR />
<form name=f1>
<input type=button name=play value="play" onclick="fun_7up()"><BR />
Right: <input id=in1 type=text name=right size=4 value="0" readonly><BR />
Wrong: <input id=in2 type=text name=wrong size=4 value="0" readonly><BR />

Times Viewed: 6

Leave a Reply

Your email address will not be published. Required fields are marked *