Ramsey's theorem

5 September 2025 gamedev

Ramsey's theorem: R(3,3)=6

I'm no mathematician. Sometimes interested in mathematic topics, if they are exciting and written for amateurs. So what is Ramsey's theorem? For the ones more seriously interested, I won't even try: Take the wiki article for Ramsey's theorem instead.

Basically R(3,3)=6 says that you need at least six points, all connected to each other (via edges), if the following should hold true:

  1. The edges can be coloured in one of a total of two colours (because there are two numbers written inside the parentheses), and
  2. it is impossible, to not have at least one triangle of each colour (because those both numbers happen to be three's). If you had only five points, aka a pentagram framed inside a pentagon, the condition would not hold true.
The game board. Six points, all connected to each other via neutrally coloured (grey) edges. The points are labelled A to F. Above the board the text says 'turn: human'.

Where did I get this from?

On hacker news there was a paper linked, it was about a new method to calculate the lower bound of a ramsey number in a more precise (but still fuzzy) way. That sounded like an interesting problem, since it seems to be unsolved as of today!

So I was reading the abstract, then the wiki article. There is somewhere mentioned that you could make a game out of that. The footnotes had an example linked, which was located on some university server, but didn't work for me. So I thought, this can't be too hard to do. Took me still some time, naturally, but now it's there. Should be mostly bugfree by now, even.

Where is the game?

R(3,3)=6 on itch.io

More screenshots on the store page. Playable in browser, possibly even works on mobile.

Conclusion

Is it, like a banger? Well, no. My presentation also leaves some things to be desired, it's pretty minimalistic. But, it was meant to be a prototype only.

I felt like trying it, and the idea has a nice small scope. So it was a good occasion to refresh my paperthin layer of kaplay knowledge.

KAPLAY mentioned! A JS/TS game framework for the browser, find it at kaplayjs.com.

The game itself is not trivial to beat though, most likely a few attempts will be needed to beat the computer. Which is doing nothing fancy, though. The "strategy" consists of a) find a random neutral edge, check if colouring this edge would make the computer loose the game, and if so, pick a random neutral edge again and go with that.

Before I forget to mention it: Code is on github (MIT). If you are not familiar with such projects, the interesting part is in the directory /src. In the code, there are things left to clean up and optimize, but it works as it is, and the source should be readable.

I consider the thing done therefore, except another bug pops up!