You are given a tower consisting of identical cubes, each of which has the same colors on the vertical sides in the same clockwise order: red, green, blue, and yellow. These colors are represented respectively by R, G, B, and Y. The goal is for all cubes to be aligned in that all colors are the same going up vertically. A tower enjoying such an alignment is called tidy.
Two kinds of operations are allowed:
i. rotate a cube one or more positions clockwise or counterclockwise and
then all cubes above it rotate by the same amount or
ii. rotate a cube c1 and hold a cube c2 above c1
so that neither cube c2 nor the cubes above c2 rotate
but all cubes starting with c1 and up to the cube just below c2 rotate.
Suppose that we count as a unit of a cost rotating a single block one position either clockwise or counterclockwise. So if k blocks are rotated two positions, the cost is 2k.
In the single person game, you want to make the tower tidy using as few operations as possible provided you stay within a given cost budget. Both the initial tower and the budget will be given on the day of the competition. If one solution s1 uses fewer operations than solution s2, then s1 is better. If s1 and s2 use the same number of operations but the cost in s1 is less than for s2, then s1 is better.
Example: Suppose we start with the configuration (from bottom to top): RRGYG where each letter represents the color of the block facing the player.
To bring these into alignment, rotate the top three one position counterclockwise yielding RRRBR and then rotate the fourth block counterclockwise by two position and hold the top block steady to obtain RRRRR. Such a solution requires two operations and a total of three single block rotations for the first operation and two single block rotations for the second operation (because the fourth block is rotated twice). Thus, the score of that solution is (2,5).
Consider a solution just like this one except the rotations are all clockwise. So the first operation rotates the top three blocks clockwise by three yielding RRRBR and the second operation rotates just the fourth cube clockwise by two. The score of that solution is (2,11), because the first operation had three blocks rotating by 3 each.
Consider a solution that rotates the third block counterclockwise one position (by holding the fourth block steady), the fourth block clockwise one position, and finally the top block counterclockwise one position. That solution has a score of (3,3).
Of these three solutions, provided the budget is 5 or more, (2,5) is the best followed by (2,11) followed by (3,3). However, if the budget is 3 or 4, then the (3,3) solution is best.
In the two person game, the winner is the one who leaves the tower tidy. The same operations are allowed except that neither player is allowed to rotate the bottom block nor to move the tower to a configuration that is the same as a previous configuration. By the pigeonhole principle, this game must end at some point.
We will play the single person game for starters.
Here is the architecture of a variation of the game of nim game (so a completely different game but with a similar communication setup) by Zachary DeStefano and Graham Todd from 2021. It has a server, 4 clients (web, c++, java, and python), an html observer interface for watching two bots play against each other, and a README with documentation on how to run the server and modify the clients.