Tic Tac Toe Grow
- Not to be confused with Tic Tac Toe.
Tic Tac Toe Grow is a 2D language created by User:Icecream17. There's a mainBoard and 3 memory boards. Because you can't control much this is very hard to program in.
Features
Grid
Just like in tic tac toe, the starting grid is a 3 by 3 square
______ |_|_|_| |_|_|_| |_|_|_|
Your cursor starts at the top left box and the default direction is right. When you type a character the program goes over the whole board, runs if 'r' is there, then updates the board.
A character you type appears based on the order (explained in memory2). For example, if the order is
1 2 3 4 5 6 7 8 9
and this is the 3rd character you type, your character appears at 3.
Characters you type can overwrite other characters
To simplify things, the code is run left to right, top to bottom.
Board update
In regular tic-tac-toe-grow, when you play X or O on a square on the perimeter of the board, the board become bigger like so:
______ ______ |_|_|_| |_|_|_|_ |_|_|X| --> |_|_|X|_| |_|_|_| |_|_|_|
And turn two
______ ________ |_|_|_|_ |_|_|_|_|_ |_|_|X|O| --> |_|_|X|O|_| |_|_|_| |_|_|_|_|
Same thing with the actual code, the mainBoard gets bigger. (The board makes new positions "one cell orthogonally" from each play.)
Memory
The memory is also a board that can be filled with data and/or "get board update". Although, unlike the main code board, the memory doesn't update automatically and doesn't get overwritten
When you put something into memory, it puts it into the first available cell. (0 is treated as empty, btw. available cells are cells that are empty.)
If there's no more room, it does
1. The main-board and the memory 1 switch places. 2. Write to the first available cell in memory 1. a. If there are STILL no more cells left, switch memory 1 (which used to be the main board) and memory 2. 3. Stop the code
Memory 2
This can be thought of as the "settings" or "options"
Although it is also a board that can be updated with data, it will reset to the values in memory 3 if a cell has incorrect input. It starts with all 0s.
Only binary values (0 or 1) is allowed.
It does not board update.
Here's what the values of each cell changes for the "settings".
123 456 789
1, 2 = MainBoard direction 3, 4 = Starting direction when checking memory 5 = TURN left, or right? (0 or 1) 6, 7, 8, 9 = Binary for the number to start at.
Directions: 00 = left, 01 = up, 10 = right, 11 = down
1 and 2 goes either row by row or column by column.
Right Left Up Down 123 132 147 147 456 465 369 258 789 798 258 369
But 3, 4 changes direction by turning (defined in 5). It also goes through the board like a torus.
So if you go left it does this:
1__ --> 1_2 --> 132
Then it can't go forward. So it turns.
Let's say the value in 5 is 0 (turns left).
132 --> 132 --> 132 --> 132 --> 4 --> 4 --> 849 --> 56 --> 756
More examples: Start right, turn right:
123 894 765
Up and turn left:
178 354 269
7 can also be the value 42, which represents 1. If the four digit binary is not from 1 to 9, it will reset to 0 0 0 1 (one).
If memory1 is not a regular board, and it switches with memory2... (example memory1)
____ _|_|_|_ _____ _|_|3|a|_|_ |0|0|0| |_|>|_|9|4|_| switch with |0|0|0| |_|&|7|_|_| |0|0|1| |_|_|
It just takes the first (top-left) cell and forces a 3x3 board from there. (Even if there's no board there.)
____ ______ _|_|_|_ --> |_|_|_| _|_|3|a|_| --> |3|a|_| |_|>|_|9|4|_| --> |_|9|4| |_|&|7|_|_| |_|_|
Note the top right corner was forced into existence.
The order always starts at the top-left cell.
Memory 3
Generated based on the binary ascii representation of the file name. Always generated left to right, top to bottom.
Example:
wow.txt = 01110111 01101111 01110111 00101110 01110100 01111000 01110100 12345678 9
becomes
______ |0|1|1| |1|0|1| |1|1|0|
(If this was regular tic tac toe....)
Actions
r = when on mainBoard, the code will run. does nothing otherwise, only for detection/activation
o = Take the first nonempty memory value. (If there are none output nothing) If the value is a number, output all numbers in memory1, else output all characters in memory1 t = take the next square and put it into memory
c = turn the mainboard clockwise even if there's no 'r' u = update MainBoard +, -, *, /, % (mod) (memory cell 1) op (memory cell 2) = memory cell 3
? = if (the next square) is not empty, clear it and put it in memory. Repeat the code ^ v < or > changes the direction g = force "board update" on memory 1 immediately. code restarts from g
d = delete all of memory1 p = pop the first memory1 space and output it
s = "save memory1" - see section @ = function created by 's' if 's' wasn't called yet it just does the code in memory1
! = skip the next command if the next command is '!' also it skips 2 commands | = flip the direction (Enter) = If direction is down, go left (Space) = empty value, but occupies space. doesn't make the board grow in board update. (Backspace) = Undo last run or write or board update. If you press 'backspace' at the start, the whole program breaks and outputs "hello world" in -1 bytes # = escape the next character
Σ = Output the sum of all memory1 values. (Alt + 2020). Numbers go before characters. 2 + 'a' = [2, a] and outputs 2a 2 + 'a' + 7 = [9, a] and outputs 9a 'wo' + 7 + 'ws' = [7, wows] and outputs 7wows
Anything else = puts (number or character) into memory1
If it takes more than 10000 actions the board resets to empty values.
Edge cases
n / 0 = 42
n % 0 = n % 42
In checking memory, if you can't go anywhere...
______ |1|7|_| |2|6|_| |3|5|4| |8|
Start at the top left and check the remaining board.
______ __ __ |1|7|_| --> |_| --> |9| |2|6|_| --> |_| --> |0| |3|5|4| |8|
When you put a character at the last cell according to the "order", the next value will be put at cell 1.
(In the mainboard) Going to the next row or column means shifting the column by one and then going forward in the same direction. For example, going left:
____ ____ _|_|_|___ _|1|2|___ |_|h|i|_|_| the order is |4|3|7|6|5| |_|_|_|_| --> |8|b|a|9| |_|_|_| |e|d|c|
If there's still spaces left in the same row the directions keeps going through walls and already taken spots.
___ _ ___ _ _|_|_|_|_|_ |1|3|_|2|_ |_|p|i|_|e|_| the order is |5|4|9|8|7|6| |_|_|_|_|_| --> |a|e|d|c|b| |_|_|_| |h|g|f|
See the first row, where the lop-left space goes left to 2, then jumps to 3.
Save board
Action s is good because it creates a function @ from the memory. So if the memory does something useful, you can call @ to "do" the code in the memory at the time 's' was done.
There's a (list of @ states), and an (@ inside an @ function) calls the (previous @ in the list of states).
@ example: ______ ______ |_|v|_| |a|v|1| |@|<|<| calls --> |_|_|_| |_|<|^| |_|_|_|
Program
A program can just be written as the characters you type, since you can't control anything else, like where the pointer or cursor is. (Except indirectly through your code)
You might also include the file name, though memory2 will still be 0s at the start. Convenience: (0 0 0 0 0 0 0 0 0) = Left, Left, Left, 1
Example programs:
wow.txt --> hello world (outputs "wehllwehlll " with a space on the end)
End state: mainBoard memory1 ______ _|_|_|_|_ ________________ |_|w|e|h|_|_ _|e|_|_|_|_|_|_|_|_ |_|w|l|h|d|_| |l|r|o|w|h|e|l|l|o|⎵| |_|l|l|⎵|_| |_|_|_|_|_|_|_|_|_| |_|_|_| |_|_|_|
As of now a program that outputs "hello world" has not been made.