As the title says im trying to create a Javascript program that allows the user to play pontoon. I have got this far and have got stuck on an error I cant see.
Please keep explinations simple as im very new to java script.
Thanks.
<HTML>
<HEAD>
<SCRIPT LANUAGE = "javascript">
function stick_option ()
// This will ask the player if they wish to stick or not
{
var playerans = 0;
playerans = prompt('Do you with to continue?', Y/N?);
if (playerans = Y)
counter = (counter + decounter);
}
function bust_teller ()
//This is a function to tell the player they are bust
{
alert('Your cards have exceded 21 - Your Bust');
counter = (counter + decounter);
}
function main_function ()
//This is a function to add 5 playing cards and add up the total
{
var cardtotal = 0;
var cardout = 0;
var counter = 0;
var decounter = 0;
while (counter < 5)
{
cardtotal = prompt('Enter your five cards -', 0);
counter = counter + 1
decounter = decounter + 5
decounter = decounter - 1
cardout = cardout * 1 + cardtotal * 1;
{if (cardout > 21)
alert('Your cards have exceded 21 - Your Bust');
bust_teller () }
else
if (cardout < 16)
alert('Your hand is high enough to stick on')
stick_option ()
}
alert ('Your hand is ' + cardout);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME = "my form">
<center>
<P>Pontoon</P>
<p>You will be asked to input the cards you have been dealt</p>
<input type = "button" VALUE = "Start"
onClick = "main_function () ;">
</center>
</FORM>
</BODY>
</HTML>
Please keep explinations simple as im very new to java script.
Thanks.
<HTML>
<HEAD>
<SCRIPT LANUAGE = "javascript">
function stick_option ()
// This will ask the player if they wish to stick or not
{
var playerans = 0;
playerans = prompt('Do you with to continue?', Y/N?);
if (playerans = Y)
counter = (counter + decounter);
}
function bust_teller ()
//This is a function to tell the player they are bust
{
alert('Your cards have exceded 21 - Your Bust');
counter = (counter + decounter);
}
function main_function ()
//This is a function to add 5 playing cards and add up the total
{
var cardtotal = 0;
var cardout = 0;
var counter = 0;
var decounter = 0;
while (counter < 5)
{
cardtotal = prompt('Enter your five cards -', 0);
counter = counter + 1
decounter = decounter + 5
decounter = decounter - 1
cardout = cardout * 1 + cardtotal * 1;
{if (cardout > 21)
alert('Your cards have exceded 21 - Your Bust');
bust_teller () }
else
if (cardout < 16)
alert('Your hand is high enough to stick on')
stick_option ()
}
alert ('Your hand is ' + cardout);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME = "my form">
<center>
<P>Pontoon</P>
<p>You will be asked to input the cards you have been dealt</p>
<input type = "button" VALUE = "Start"
onClick = "main_function () ;">
</center>
</FORM>
</BODY>
</HTML>