View Single Post
Old 11-30-2012, 09:03 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,244
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
This makes NO SENSE at all:
Code:
		randomCard = Deal();
		a = randomCard;
		player [0] = randomC();
You get a randomCard. Fine. Then, for some weird reason, you assign it to the variable a

Why didn't you simply code a = Deal();?

But then you set player[0] to the result of calling the function randomC()!

WHY???

*APPARENTLY* you have a Deal( ) function that returns one random card. That's great. But then why do you have *ANOTHER* function randomC() that does the same thing????

On top of that, you get the score for the player by adding player[0] and player[1]. But why in the world would *THAT* score match the sum of the values of a and b??? Except by the wildest coincidence?

*********

In your second post, you show this:
Code:
document.write('<img alt="random image" src="' + playerC[a] + '"/>');
Now, all of a sudden, you have introduced the array playerC[].

Where did *THAT* come from?

In the prior code, you had player[0] and player[1], but you certainly didn't have any playerC[ ].

On top of everything else, document.write is badly obsolete and you should *NOT* be using it.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote