i do not know how to write the source code, i'm only able to write the game for 1 player only. please help me to make it into a multiplayer game, thanx!
How do i write a multiplayer number guessing game in C language?
I am assuming the game would go like this. The computer picks a number and then the players take turns trying to guess it telling each other higher or lower. The "number" is a global variable. It is basically the same program as the single player with two differences. You need a player_1_guess and player_2_guess variables and your main logic needs to be in a while loop that is keying off a found_winner Boolean variable. Odd time through let player 2 play.
As far as the interface, you might want to do something where you mask the guess when it is typed in by: get a digit and then send a backspace and asterisk or pound back to display so a guess looks like:
Player 1 Guess: ** - To High
Player 2 Guess: ** - To Low
Player 1 Guess: ** - To Low
Reply:Thank you very much for your help! Report It
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment