crimsontide5 Posted August 31, 2013 Share Posted August 31, 2013 (edited) I'm newto this forum, so hello and thanks in advance for any advice you can give me. I am also new to PHP and am working on my final project for my PHP class. I've got most of the code done, but am having trouble figuring out how to set it up to keep score during a game using cookies. The game is called Two-Dice-Pig. I was able to get the human player working fine, but when I added the two computer players, it stopped showing the dice images. I've attached the PHP file of where I'm at now. DiceGame.php And here are the rules for the game: Each turn, a player repeatedly rolls two dice until either a 1 is rolled or the player decides to "hold":- Two standard dice are rolled. If neither shows a 1, their sum is added to the turn total. If a single 1 is rolled, the player scores nothing and the turn ends. If two 1s are rolled, the player’s entire score is lost, and the turn ends. If a player chooses to "hold", their turn total is added to their score, and it becomes the next player's turn. The first player to score 100 or more points wins. Your game will have three players – you and two computer players. Each time a player “rolls”, the two dice should be displayed – for the human player, an option to either roll again or hold should be displayed. For the computer players, they will randomly choose to roll between 1 and 5 times unless their turn is ended by either winning or rolling a “one”. All players’ scores should be displayed at all times during the game and the turn total should also be displayed as a player is playing – once someone “wins”, an option should be displayed to “play again” or quit the game. Thanks again for any help Edited August 31, 2013 by crimsontide5 Quote Link to comment https://forums.phpfreaks.com/topic/281717-3-player-dice-game-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.