jes notes Index Gallery . 4th axis Blog ideas Micro-machining CNC milling machine Paint colours CNC Router Shaft passers Software ideas Stepper motor clock Toy ideas Watchmaking Wildflowers

2024-07-21

Last modified: 2024-07-21 15:53:22

< 2024-07-18 2024-07-26 >

GPT Blotto

The plan is to make Colonel Blotto: https://en.wikipedia.org/wiki/Blotto_game - except you play against GPT4o.

The Colonel makes his allocation and sends you a SHA256 commitment. You then make your allocation and send it to the server, and you get to find out his allocation and the text to prove his commitment was valid.

Then he gives some analysis/commentary/coaching, and you can chat to him if you want, and then the next round starts.

It will be interesting to see if the user can manipulate him into making bad moves via the chat box. Also whether we can get him to manipulate the user.

How could you set difficulty settings? Just ask the Colonel to play bad moves?

I think I want a DALL-E art of the Colonel to use on the web page.

The backend will be Mojolicious, communication over websocket.

I got ChatGPT to write the user interface, I just gave it a description of the websocket protocol, and it worked, incredible technology.

Current status is:

Here are the changes I want to make:

  1. As an alternative to "Start New Game" I want a button that says "Tell me the rules" or something, and when they click it it pops up the rules, and then they can close the rules and start a game instead.
  2. Put "By James Stanley & ChatGPT" at the bottom.
  3. When you start a game instead of popping up an input box to select the number of rounds, just have 3 big buttons to select from, "3 rounds", "5 rounds", "10 rounds".
  4. When the websocket is disconnected, display an error message.
  5. During the soldier allocation, lay out the 10 input boxes horizontally on one line and make them larger.
  6. During the soldier allocation, show a running total of how many soldiers have been allocated.
  7. Don't allow the user to submit an allocation that sums to more than 100 soldiers.
  8. When showing the colonel's thinking, make it more clear that he is thinking, perhaps display a spinning animation or something next to the thinking text.
  9. When showing the colonel's allocation, instead of popping up an alert box, instead put it somewhere subtly on the page, and show a bash command line people can use to verify the commitment
  10. Hide the chat during allocation selection.
  11. Let the user start picking their allocation as soon as the round starts, even though the colonel is still thinking.
  12. Add a button that will fill in a random allocation.
  13. On each round, show the colonel's allocation from the previous round.
  14. When the final round is complete, make it clear that the game is over.
  15. Initialise the allocation input boxes with all 10s.

I'm going to paste the current UI code to ChatGPT and have it try to make those changes, will see how well it does.

It actually did a really good job. Changes required:

Now we need:

And now:

Now:

The interaction with ChatGPT for programming like this is quite unwieldy. You have to keep clicking "continue generating" because the output gets too long, and it takes a very long time for it to keep outputting almost exactly the same code every time. Ideally it would work more like a human and use some sort of editor to just change the parts that need changing.

OK, I did some finalising by hand, and I think this is ready. I ought to put a limit on the number of simultaneous in-progress games to stop people wasting my OpenAI credit.

Now live at https://blotto.incoherency.co.uk/ - I should blog this tonight before I lose interest in it.

< 2024-07-18 2024-07-26 >