Getting ChatGPT to create a game for me…

Here is the conversation (my side of it anyway) I wrote to ChatGPT to make a simple dice game. The concept of the game is:

  • 1.) A Target number is given for you to attempt to match.
  • 2.) Press the Roll the Dice button to roll a virtual 1D6, you have 10 chances to match the number.
  • 3.) The total of your rolls is at the bottom of the screen, keep Rolling until you get close to the Target number.
  • 4.) There is a + and – where you can add or subtract a number to your roll.
  • 5.) If you overshoot your number, you can press Take a Chance (at the cost of 2 chances) to reduce your total by 1D6.

It’s fairly simple and a little too easy to win but I just wanted to try out having ChatGPT code for me. It worked fine but at times the website was very slow to respond or it would require closing out and going back in. My next step (and next blog) will be me giving ChatGPT a more detailed request for a game in one paragraph (entry) and seeing how it applies the description to making a game. Basically a one request game.

This is the transcript of what I asked ChatGTP4 to do. It’s responses were a regurgitating of the ask with the code listed. So this is what it takes to get something made… Not bad for someone who has nearly ZERO experiencing with coding…

  • Id like to create a html dice rolling game.
  • remove the history section
  • Change the word “Life” to “Chances Left”. Below “Chances Left” add a new randomly generated number between 2 and 20 called “Target Number”. After each time someone presses “Roll the Dice”, keep that result and add the previous result to it.
  • Change the random “Target Number” to 8 to 20.
  • next to Total of Rolls add a – button and a + button. These buttons can either add 1 to the total or subtract 1 from the total. The player can only add or subtract up to 2 per Roll. If at any time the Total of Rolls equals the Target Number the player wins. If the uses all chances, then the player looses.
  • make the – and + buttons only allow subtracting or adding 1 instead of 2.
  • create a new button called “Take an Extra Chance” which reduces Chances by 2 and subtracts 1D6 from the Total of Rolls.
  • the + and – buttons can only add or subtract 1 from the “total of rolls” after each “Roll the Dice”. If at any point the Target number equals the Total of Rolls, then the player wins.
  • The chances left button is not working
  • The Chances Left value should reduce after each time the Roll the Dice button is pressed and should reduce by 2 each time the Take and Extra Chance button is pressed.
  • show all the html code
  • show the complete java code
  • The Chances Left value is not reducing after each time the Roll the Dice button is pressed.
  • roll the dice button is now not working
  • If the “Chances Left” value 0 then the player looses the game.
  • show all the java script code
  • When a player wins, do not clear the screen, just display “You Win!” in the screen and a button below that that resets the game.
  • show all the java code
  • the game works great. how can I make it look more exciting?
  • show all css code
  • where in the html does it reference the css code?
  • I would like to place this on my wordpress site, how do I do that?
  • show me the complete html code with the embedded css and java

The game is below but WordPress won’t allow it to work correctly (but it does, outside WordPress).

Dice Rolling Game

Chances Left: 10
Target Number: 0
Total of rolls: 0

So all I am trying to get across with this post is how AI will change how we use technology. I can now turn real world dice games into PC ones fairly easily. Give it a try yourself!

Leave a Reply