' +-------------------------------+ ' | Sample Program for Virus Wars | ' +-------------------------------+ ' ' This is a sample program for virus wars. This is the code for a very simple ' virus that will slowly infect the body. It doesn't have the ability to ' trap opposing viruses, so it's fairly weak. It does give a nice example of ' how the code will work. ' ' If you're a programmer, you should be able to follow along fairly easily. ' I've added a comment to every line of code to make it easier to understand. ' ' If you're not a programmer, smile and nod. ' ' ' Directions the virus can move ' ----------------------------- ' 1 - Right ' 2 - Down ' 3 - Left ' 4 - Up ' ' Flag definitions ' ----------------------------- ' 1 = Constant value of: 1 ' 2 = Current Direction. ' 3 = Work Area ' 7 - Constant value of: 0 ' 8 = Constant value of: 5 ' Program starts here! ' Initilize starting data. 01 SetFlag (1) (1) ' Set Flag 1 to value: 1 02 SetFlag (2) (1) ' Set Flag 2 to direction: Right 03 SetFlag (7) (0) ' Set Flag 7 to value: 0 04 SetFlag (8) (5) ' Set Flag 8 to value: 5 ' Start Main Loop 10 MovePointer (2) (3) ' Move the pointer in the direction of flag 2, store the result in flag 3. 11 If (3) (0) (20) ' If flag 3 = 0 then the move failed, goto 20. 12 CheckCell (3) ' Check the current cell value, and store into flag 3. 13 If (3) (0) (30) ' If flag 3 = 0 then the cell is empty, goto 30. 14 Goto (10) ' Back to start of loop. ' Sub - Change direction. 20 Increment (2) (1) ' Add 1 to the direction. 21 If (2) (8) (25) ' If direction = 5, goto 25 (Direction must be 1,2,3,4) 22 Goto (10) ' Back to main. ' Sub - Loop back to 1 25 SetFlag (2, 1) ' Reset the direction back to 1 (Right) 26 Goto (10) ' Back to main. ' Sub - Infect a cell 30 Infect() ' Infect the cell. 31 Goto (10) ' Back to main.