01network > cat virus.txt
The virus that you have to develop will be a worm guided by artificial intelligence. Once introduced into the access point, it must be able to act by itself, locating the various data sources while avoiding firewalls that would make the trace impossible. You have to provide the behavior of the virus. It will evaluate a series of conditions and when a move is made, it will restart evaluating from the current position.
Note that a given access point matrix is made of a 60 by 60 grid, containing 200 datasources and about 400 firewalls.
The grid coordinates are represented like this :
[ 0, 0] - [ 1, 0] - [ 2, 0] ... [59, 0]
[ 0, 1] - [ 1, 1] - [ 2, 1] ... [59, 1]
[ 0,59] - [ 1,59] - [ 2,59] ... [59,59]
Here is the list of the existing assembly commands. These codes are then converted into machine language by the system. Please note that the assembly language can be extended : in case a programmer requires an additional command, he can make the request and we'll check if it can be added to the list of possible commands. Each command line must be ended with a semicolon.
START-> Start of the routine iteration.
END-> End of the routine iteration.
RHT-> move the worm 1 square right
LFT-> move the worm 1 square left
UP-> move the worm 1 square up
DWN-> move the worm 1 square down
EVAL(x,y)- > replace x and y with position numbers, return grey, blue, red or green
IF(EVAL(x,y) = COLOR):OPERATION-> verify the condition. If the square is of the verified color, executes the
OPERATION. Please note that
IFsequences can be chained. For example, the following line :
IF (EVAL(posX+1, posY) = grey):IF (EVAL(posX+2, posY) = grey):RHT;
can be translated to if the first square to the right is grey and the second square to the right is grey, move right.
*It is now possible to very if a condition is not met.
IF(EVAL(x,y) ! COLOR):OPERATION
Existing colors :
green-> The worm
grey-> Empty space
blue-> Data source
The virus code must be written with 1 instruction on each line. Each line must be ended with a resulting move. It will be run as long as all datasources are found, if the worm is in a square with no move provided or when the worm ends on a firewall. The virus able to catch the largest number of datasources in the less number of cycles in case of a tie will be the one selected to be mass produced.
Example of algorithm:
The worm checks all the surrounding squares and moves if there is a blue square. It adds or substract 1 to its current X or Y position. If there's no blue square, it moves right.
IF (EVAL(posX+1, posY) = blue):RHT;
IF (EVAL(posX-1, posY) = blue):LFT;
IF (EVAL(posX, posY-1) = blue):UP;
IF (EVAL(posX, posY+1) = blue):DWN;
IF (EVAL(posX+1, posY) = grey):RHT;
-End of file-
01network > ls