Pinkcode

Pinkcode is a 2D programming game. The name is a spoof of Redcode.
== Play field ==
The play field is a two dimensional grid of a certain size (e.g. 256x256). Height and width of the great must be equal and both 
must be a power of two. The grid is initialized to all zeroes. The grid consists of 16bit unsigned integer cells. cell values < 256 are treated as ASCII encoded
instructions. Programs are placed so that neither their X coordinates nor Y coordinates overlap. I.e.
aaaa
aaaa
aaaa bbb
 bbb
 bbb
is not a legal placement whereas
aaaa
aaaa
 bbbbb
 bbbbb
is a legal placement. Coordinates are relative to the upper-left corner.
== Instructions ==
The data pointer is initialized to the instruction in the bottom right corner.
Mnemonic	Description
 		No Operation
>		Change direction to right
<		Change direction to left
v		Change direction to down
^		Change direction to up
l		Move data pointer left
r		Move data pointer right
u		Move data pointer up
d		Move data pointer down
X		Exchange data pointer with a hidden data pointer
+		Increment cell under the data pointer
-		Decrement cell under the data pointer
L		Set data pointer to the nearest @ instruction to the left
R		Set data pointer to the nearest @ instruction to the right
A		Place an @ instruction to the cell under the data pointer
B		Place a T instruction to the cell under the data pointer
T		Terminate current process
?		If cell under the data pointer is zero branch upwards, otherwise fall through
!		If cell under the data pointer is not zero branch upwards, otherwise fall through
`		Set data pointer to the upper-left corner of the program
'		Set data pointer to the bottom-right corner of the program
:		Branch upwards if the cell under the data pointer belongs not to the enemy
.		Touch cell under the data pointer (changes ownership)
#		Set data pointer to the location of this instruction
0		Set the cell under the data pointer to zero
2		Mulitply the cell under the data pointer by two
M		cell under the data pointer module 256
S		Spawn a new process at data pointer
s		Spawn a new process at the next instruction (depending on the direction)
&		Spawn a new process at this instruction
=		Branch upwards if data pointer == hidden data pointer (compares x and y coordinates)
/		Branch upwards if cell under data pointer equals cell under hidden data pointer
x		Branch upwards if data pointer == hidden data pointer (compares only x coordinates)
y		Branch upwards if data pointer == hidden data pointer (compares only y coordinates)
p		Push data pointer to the stack
P		Pop data pointer from the stack
$		Peek data pointer from the stack
The field is arranged as
yxxxxxxx
00123456
10123456
If the x coordinate of the data pointer exceeds max width it is set to zero and the y coordinate is incremented.
If the x coordinate of the data pointer drops below zero it is set to max width and the y coordinate is decremented.
If the y coordinate exceeds max height both the x and y coordinates are set to zero. If the y coordinate drops below zero
both the x and y coordinates are set to max width/max height. Initial direction is "to the right".
== Scheduling ==
Instructions are executed alternating between two players. If player A has three processes and B has two processes then the schedule would loke like:
A1 B1 A2 B2 A3 B1 ...
== Cell ownership ==
If a process reads or writes to a cell (executing an instruction counts as reading) the ownership of the cell is handed over the process
who read/wrote to/from that cell.
== Example ==
The example first searches for an @ in memory which (if there is one) will be inside the opponent's code. Next the program pointer alternates between moving left and right over BrB which sequentially fills memory with T to overwrite any non-mobile programs. The program eventually overwrite itself and self-destructs.
R>BrB<
Category: Programming games