kvarnerexpress 0 Report post Posted March 23, 2005 (edited) I decided that I wanted to make a Javascript version ofBlack Jack, so that I could play it on my desktop.This is what I've got so far...Code: function deal_Cards(){var p='jsKid', c='Computer';document.frm_blackjack.playerName.value = p;document.frm_blackjack.computerName.value = c;var c_Cards = new Array();var c_Total = 0;var p_Cards = new Array();var p_Total = 0;var cardsLeft = 52;var suits = new Array(); if (p && c) { for (var s=0; s <= 3; s++) { suits[s] = new Array('A','2','3','4','5','6','7','8','9','10','J','Q','K'); for (var n=0; n <= suits[s].length-1; n++) { var set = suits[s][n]; // document.write( set + '<BR>'); } } }}window.onload = deal_Cards;window.onbeforeunload = function() { document.frm_blackjack.reset(); } where I am stuck at, is how do I randomize the cards thatare to passed to the players?Putting your code in the code box helps other users to read it easier. Please remember to do this next time. Thank you. Edited March 23, 2005 by snlildude87 (see edit history) Share this post Link to post Share on other sites
Carsten 0 Report post Posted March 23, 2005 Maybe this will help you: no=Math.random()*52document.write(Math.round(no))You would have to remove that card from the deck though. Can you post the followups of your code here? Share this post Link to post Share on other sites