Description
ChatGPT was given the following prompt:
Write a game of Nim in C. It should be player vs. computer. Print out the board to stdout, then ask the player where to take. Then, have the computer make its move and update and print the board. Check win condition after each move. If the player or the computer takes the last piece, announce that they have lost.
Add a title screen with the rules and an option to restart if the player wants it by entering y or n.
If the answer is n, print out "This game was made by ChatGPT," and end the program.
ChatGP’s answer: This code provides a simple text-based interface for the Nim game. Players take turns removing stones, and the game checks for a win condition after each move. Players have the option to restart the game or exit.
There was one error in the code, the win/lose condition was printed the wrong way.
We use cookies
This website uses cookies for a few things: session IDs, UI (light/dark mode) and streamer mode preferences, closed notifications, and this cookie notice. By continuing to use this website you consent to the use of cookies.