-
Notifications
You must be signed in to change notification settings - Fork 0
How does it work ?
The Cythan machine is OISC machine: One Instruction Set Computer.
This mean that when you code in Cythan, you don't use command, because there is only one command. You use argument of the same command.
Most of OISC computer machine work by making one very complex command that is a group of all the instruction of most needed commands. Cythan have use one simple command, but the way the machine is archtectured allow this simple command to make everything need to simulate a Turing machine.
The machine is compose of one line of memory cells. There are no extern data use by the machine whitch is needed for working. The memory cells goes from -infinity to +infinity.
Every positive memory cells is composed of two integers.
The first cell (0
) is the pointer cell:
- the first integer is for the pointer position.
- The second integer is for the pointer increment.
Every negative memory cell is composed of one single integer.
On the start of the machine, the code will be place in the positive cells. A Cythan code is composed such by a list of tuple.
Exemple :
1,1;-1,-2;-1,-4;13,9;13,10;16,1;14,-3;-2,10;-1,-2;-3,11;12,12;12,12;17,0;12,12;-1,-1;0,16;19,1;18,1;100,-1;999,-1
is an OR logic gate.
On execution, a cell will copy the element in the cell pointed by the first case to the celle pointed by the second one.
If the cell executed or copied is negative, it will take the content of the cell and the cell after to have 2 values.
Exemple :
5:9
say that the content of the 5th cell will be copied in the cell 9
-5:9
say that the content of the cell -5 combined with the content of cell -4 will be copied in the cell 9.
The cell 0:0 represent the pointer position, and the cell 0:1 represent the pointer adder. The pointer position integer represent whitch cell will be executed. The pointer adder reprent by how much the pointer adder will be incremnted.
Exemple :
2:1, 0:0, 1:3, 5:999
Will become next iteration3:1, 5:999, 1:3, 5:999
. The cell2:1
became3:1
because 2 (the old position)+1(the adder) = 3
We can't set somthing to the -1
cell, because it will merge content into the 0:0
. We can't also take content from the -1
memory cell.
This way -1 have a differents set of rules.
- -1 content can't be copied and earease content from an other cell.
- Copiyng content into the -1 cell will stop the machine with the output as the the cell copied
- Copying the -1 cell into an other will set the other's cell to
-1:-1
, because we can't otherwise set back a data to -1.
And that's it ! All thoses rules allow for complexeprogram and smart puzzles.
In the order, her's the list of the execution of the part of the machine:
- Get 0:0
- Get cell executed
- Get first executed pointed cell content
- Increment 0:0 with 0:1
- Set second pointed cell with content