Tuesday, May 5, 2015

C++ Blog the 2nd

NIM is a computer game where the players remove a number objects, and the one forced to remove the last objects loses. This was the second program project Ranger and I worked on. This one uses loops and random numbers. We changed the output to say “who had won.”

Random numbers are hard for computers to work with. When I hit “3” almost every time, I would always win. This was because the computer would always generate the same sequence of random numbers. So we had to start the game in a new place.

Loops would always continue on and on until we got out of it. We use loops in games to make turns continue until somebody wins.

We also made our game player versus player and it was kind of hard to do. We had to make the code for Player 2 to do the same thing that Player 1 does. This program was harder to write than the first one.

~Craig

No comments:

Post a Comment