Need help with designing a Game
Hi! I need help designing a Game called Pig in C++11, It's a dice game, but I really have no idea on how to start. It would be great if anyone can help me out.
assuming the game will be local and will have 2 human players, it's relatively simple (pseudocode below):
#include <cstdlib> (for random numbers)
create the two score counters for player1 and player2, set both to 0
create a turn counter and set to 0.
make a while loop that runs only if no players have exceeded 100 points and put this inside:
if the turn counter is 0 then player 1 goes. the dice will be declared with "((rand())%6)+1". if the dice ends up as 1 then you increment the turn counter by 1 and end the turn. otherwise increment player 1's score counter by the dice variable amount, increment the score counter by 1. ask the player if they want to hold. if not then keep running the code above in another while loop until the player either gets a 1 or decides to hold. each time, increment the player's score by the dice amount. when the turn ends increment the turn counter by 1, and end the turn.
if the turn counter is 1 then player 2 goes. same logic as player 1, but instead of incrementing the turn counter by 1 as in player 1, set it back to 0 or add 1 and apply a modulus of 2 to it.
break out of the first while loop when any player gets more than 100 points.
(you might want to include something like a congrats message or something!)
Have fun, I'll be working on a version of this and I'll probably post it to GitHub gists.
@JoshDaBosh Here's something that I did, however, I am getting compiler errors, although the program seems to compile. How do I fix it? Here's the link to what I tried: https://repl.it/@Shaheen_Fathima/RoundedRaggedAmoebas
@JoshDaBosh yes I just figured it out that it initially had compiler warnings but I fixed it now. Thank you anyways! I still think I might need help, this project is actually part of my college assignment, since it's the final assignment and the most important one, I am kind of nervous. I have the file attached and what I have done so far from my part (split into two REPLS). I got stuck in between and I really see no way on how to proceed further, in fact, I am so very confused. It would be great if I at least get even a slight idea of what I am supposed to do next. Here are two repls of what I tried on my part so far; Link 1: https://repl.it/@Shaheen_Fathima/YellowgreenSuddenQuadrilateral
Link 2: https://repl.it/@Shaheen_Fathima/RoundedRaggedAmoebas
Link to the assignment that I was given: https://drive.google.com/file/d/1h9jxjs63g_Ib3C7OiQ4QAOCrH11_Vvab/view?usp=sharing
@JoshDaBosh I am almost done, but I am totally confused on how to set a tracker to keep track of the number of turns, the second confusion is that in main(), I want only the Roll option to work when the user types R and only the Hold option to work when the user types H, the third confusion is with the resign option: what its supposed to do is this: if the user chooses to resign in between, the game should end immediately and ask the user if they would like to restart. I am in desperate need of help. Totally confused. I request to please help me out. Here's the link to the program: https://repl.it/@Shaheen_Fathima/RoundedRaggedAmoebas