# Treblecross - very simple octal game

100 views

### Péter Marcsinák

Apr 23, 2023, 4:08:17 PMApr 23
to uKenbak-1
Inspired by fellow group member Austin's Tic Tac Toe program, I tried to implement a bit simpler logic "game" named treblecross.

Since the "game" itself is not much of a challenge, I tried to make it so that the machine moves more or less optimally.

I'm confident  that it would be possible to solve this more mathematically optimally or simpler, given that the game can be considered a NIM variant, but i dont have the knowledge or understanding of game theory :)

I might try to make some optimization someday, because there are some redundant or unnecessary operations, but it was first my attemt programming this machine so it is what it is :)

Anyway its seems to work (tested on the web emulator and nanoKenbak).

Description and code below.

Treblecross is a degenerate tic-tac toe variant. The game is an octal game, played on a one-dimensional board and both players play using the same piece (an X or a black chip). Each player on their turn plays a piece in an unoccupied space. The game is won if a player on their turn makes a line of three pieces (Xs or black chips) in a row.

Description:
The game begins with all the 8 spaces empty. Press a number than START button to start the game with the selected move. The computer will move, and then it's your turn again.
Whoever reaches 3 lights in a row wins. If you win all the lights are up. If computer wins you will see the board end state (if there is more than one possible winning location of the same class - between two lights or to the left or right of them - computer move all of them).
After a game is over, you can start a new one by pressing the START button
If you want the computer to start the game press START without pressing a number. (The computer always start with the same move and plays (for the most part) optimally)

000 000 000 011 024 300 034 200 000 024 377 034 301 324 300 043 004 024 300 004 377 234 377 034 300 011 034 303 072 303 024 300 211 324 303 324 300 043 072 344 115 024 302 004 300 034 300 344 004 024 300 004 302 034 200 000 344 077 023 377 034 200 000 023 000 123 000 034 300 034 301 034 302 034 303 344 004 024 300 043 131 003 010 034 302 103 001 344 051 024 300 011 072 000 034 303 024 300 211 324 303 034 302 043 061 024 300 011 072 000 324 300 011 034 302 043 061 344 205 000 000 000 000 000 000 000 000 000 000 000 000 000 000 024 300 211 072 000 324 300 211 034 302 043 061 144 243 372 300 023 100 362 300 023 100 302 300 023 001 034 302 344 051 024 301 013 010 045 262 024 301 331 034 302 324 300 044 051 024 301 131 034 302 324 300 044 051

Treblecross v1.0.pdf