Jump to content
BrainDen.com - Brain Teasers
  • 0


unreality
 Share

Question

VNA 3.0 ~ Evolution

VNA 3.0 is a game of battle and survival, mutation and destruction. In the game, you write a program [don't lose me yet, it's a very simple language, even much simpler than previous VNAs] and then the program takes it from there, hoping to win out over enemy programs and conquer the Virtual Node Array.

Digital virii vying for computer memory may not sound like your slice of cake, but it's actually an exciting and engaging game :)

This is the most radical change on previous VNA games - so I wouldn't advise going and looking through those topics for advice, programs, etc - you'll be able to find all that here and more :D

Let's face it: while I tried to pepper up VNA 2.0 to make it more accessible to non-programmers, it really only catered to those with a knack for coding. VNA 3 is different in that it's much easier to grasp - anyone can be awesome at this game :)

So, what does VNA even stand for? It's an acronym for "Virtual Node Array", a cyber-arena of 300 "nodes". This epic warzone is where the battles take place. Where the digital evolution takes place.

So what is a node? Well a node is like a little memory niche within the VNA, a distinct line of code. Nodes are numbered 0 to 299 but this is irrelevant - the VNA wraps around like a Mario game, so if you go over the top, you come out on the bottom, and vice versa. Thus, if you were on node 290 and go forward 20 nodes to 310, this is actually the same node as node 10. ie, 300=0, 301=1, 302=2, 405=105, 599 = 299, 600=0 again, etc. Likewise, -1 = 299, -2 = 298, etc.

Because of this, your program never knows its "absolute address" within the VNA... everything is relative. When dealing with a line number, 0 means the current node. 1 is the node one line down from your current position, etc. Say your current position is at node x:

* this is node -2

* this is node -1

* this is node 0, ie, the current line

* this is node 1

* this is node 2

This is probably the most complicated concept of VNA 3.0, so if you're good with this, you're ready :P

Moving on, to the concept of pointers. Each person has nine pointers, indexed with a digit from 1 to 9. At the beginning of the game, only pointer 1 is activated, the rest are in "stasis" mode. A pointer carries two statistics: Node and Energy.

Node signifies what node the pointer is currently on. Thus when the pointer runs, it runs that node and executes a command telling the program what to do. After most nodes, the pointer's Node value increments by 1, so that it runs the next node on the next round.

Energy signifies the digital life force of the pointer. The original pointer (#1) starts out with 10 energy. When a pointer runs a node, its energy is decremented by 1 unless the node's command is FOOD, which adds 1 to energy. If a pointer reaches 0 energy, it dies and returns to "stasis".

You win when all of your enemy's program's pointers are dead.

So, in the beginning, your program is placed randomly into the VNA. Your pointer #1 is given 10 energy and its Node is equivalent to the starting node of your program.

The two warring programs start at an undeterminable distance apart. All other nodes are inhabited by JUMP 0,1 ... essentially a "blank" node that just increases the pointer's Node value by 1.

Then the game begins!!!

The game progresses in rounds. Each round, your pointers are run through. Pointer #1 goes first, then #2, etc, all the way up to #9. If a pointer is in stasis, it is skipped. Then it's your opponent's turn. A round consists of a full turn by both players.

So, what do nodes consist of?

A single node is made up of a "command" and then a space and then two "parameters", separated by a comma. Parameters are just input for the command.

Here are the commands:

Commands:

------------------------------------------

name		   effect on pointer's energy 

-------------------------------------------


COPY a,b			-1 energy

JUMP a,b			-1 energy

EDIT a,b,c		  -1 energy

FOOD a,b			+3 energy
That's it! Just 4 commands ;) 'a' and 'b' are the parameters, and they can be any integer, negative or positive or zero. The 'c' parameter of EDIT is an unchangeable modifier that says how the EDIT should work So what do the commands do? Note: at the end of each command listing, there will be an italicized sentence saying 'Aftewards' followed by some specs. This is just what happens to the pointer running that command after it runs it. For example, Node +1 means that, after running this command, the pointer will jump to the next line and run that on the next round. And Energy -1 means that the pointer will lose a bit of energy after executing that command. COPY a,b Copies line 'a' into line 'b'. Remember that line references are relative, so line 0 is the current line, line 1 is the next line, line 2 is the line after that, etc. Likewise, line -1 is the previous line, line -2 is the line before that, etc. COPY copies the ENTIRE line... the command and both parameters. It completely overwrites what was previously in node b Afterwards: Node +1, Energy -1 JUMP a,b JUMP takes pointer of index 'a' and changes its Node value to 'b'. Thus 'a' must be a single digit number 1 to 9, or 0 to refer to the current pointer executing the JUMP command (you could also refer to the current pointer by its exact 1-9 index). An invalid pointer number [not 0 thru 9] will result in no pointer being jumped. If the pointer in question is in "stasis" and doesn't yet exist in the VNA, using JUMP will create that pointer at line 'b' ... the new pointer has the same energy stat as its "parent" pointer. Afterwards: If current pointer was jumped, then the current pointer is Node=b and Energy -1 If another pointer was jumped, then the current pointer is Node+1 and Energy -1 EDIT a,b,c This is used to edit node 'a'. That is, the command is somehow changing one or both of the parameters of line +a. The 'b' parameter is a number that's applied to the target parameter (by either replacing the target parameter's current value, or adding to it, or multiplying by it, or some other operation), and the 'c' parameter is the modifier, which is a string of three characters in a row that tells which parameter to edit and how to edit. The first character has three options: a = edit a-param of node 'a' b = edit b-param of node 'a' x = edit BOTH params of node 'a' to the same number Thus you can use either "a" or "b" or "x" as the first character, and this will tell the emulator which parameter [or both] that you want to edit. The second character says how to use 'b' ('b' = the b-parameter of the EDIT line) to change the target parameter: ~ = replace parameter with 'b' [default] + = add parameter to 'b' * = multiply parameter by 'b' % = divide parameter by 'b' and take the remainder [if something would have been divided by 0, the emulator treats the '%' as a '~' instead] / = divide 'b' by the parameter and take the remainder [if something would have been divided by 0, the emulator treats the '%' as a '~' instead] & = 'b' is appended to the end of the parameter (ie, 3&4 = 34) ^ = the parameter is appended to the end of 'b' (reverse of &) > = the new value is the larger of the two values < = the new value is the smaller of the two values The third character can change what is seen as 'b': : = 'b' is 'b', ie, the b-parameter of the EDIT line [default] @ = 'b' is actually the a-parameter of node +b - = 'b' is actually the b-parameter of node +b x = can only be used if the first character was also x. This matches the 'a' parameter of node +b with the 'a' parameter of the target line and the 'b' parameter of node +b with the 'b' parameter of the target line EXAMPLES To replace the a-parameter of line +5 with the number 6, you would do this: EDIT 5,6,a~: Another example: EDIT 1,2,a+@ JUMP 4,0 COPY 7,0 When the EDIT is run, it will edit line +1, which is the JUMP. Looking at the first char of the c-param, it will edit JUMP's a-parameter. From the second char, we know it will add something to the parameter's current value (which is 4). From the third char, we know what to add: the a-parameter of line +b. b is 2, so line +2 is the COPY. The a-parameter of this is 7. So 7 is added to the JUMP's current a-parameter (4), making the new JUMP a-parameter equal to 11. This is the next state of the VNA: EDIT 1,2,a+@ JUMP 11,0 COPY 7,0 This: EDIT 0,1,x+x COPY 5,9 will edit both parameters of the EDIT, and it will use node +1 (the COPY line) to edit. It corresponds 'a' to 'a' and 'b' to 'b' so 5 is added to the EDIT's a-parameter and 9 is added to it's b-parameter, making the new situation like this: EDIT 5,10,x+x COPY 5,9 As you can see, you can do some powerful things with EDIT. But often you want to use it for something simple too. If you just want to edit line +a's whatever-parameter to be equal to 'b', use a tilde ( ~ ) for the second char and a colon ( : ) for the third char. These are the default values anyway. NOTE: There's no need to memorize or even understand all of EDIT's capabilities, so don't worry yourself. The only reason I made so many features is so, once you know exactly what you want, you can make the EDIT command behave the way you want it to. Afterwards: Node +1, Energy -1 FOOD a,b No actual effect other than raising energy. Afterwards: Node +1, Energy +3 ~~~ Advanced Features that may help you out: This stuff may confuse you, so don't let it deter you from VNA 3.0 ... it's only here to provide advanced functionality once you have the grip of the game. You don't need it yet, it will only serve to confuse the hell out of you. So unless you've played VNA 3.0 for a little while and understand it back to front, then click on these spoilers :D:D You can forget about this spoiler for a bit. Trust me. VNA 3.0 isn't as bad as you think ;D ~~~~ There are no functions in VNA 3.0 ... this is it. As you can see, it's very simple. It may not seem so now, but it's very easy to make programs. I'll give you an example: :)You may think that efficiency and power take a hit with the absence of functions, but VNA 3.0 is actually more powerful, while being simpler, than you think - the multiple pointer capability allows you to partition different code areas for different pointers to run, creating a lively ecosystem of your pointers working together to crush the enemy... Post here to submit & discuss programs, talk about the game, etc. We may have a tournament soon/later/whenever (as of now I have two fully tested battle programs - 'Hydra' and 'Redhopper', and also 'Hydra II', an improvement on the first Hydra) ;D Also, I see no reason that VNA 2.0 shouldn't continue alongside VNA 3.0, they are different enough I think
An advanced feature that may assist you is a concept known as a variable - a symbol used to store data. In VNA 3.0, there are three basic variables: ! # $ you can use them in commands instead of a number. Ie: COPY !,6 or even two variables: COPY !,$ or two of the same variable: COPY #,# '!' and '#' are independent to your program, so you and your opponent can have different '!' and '#' values. However, '$' is a shared variable, and you and your opponent(s) have access to the same '$' You can set the variables with the following three commands:
SET!	  a,b

SET#	  a,b

SET$	  a,b
All three have the effect on energy of ±0 .. ie, they have no effect and do not reduce nor add to energy. Also, after running a SET command, the Node of the pointer goes to the next line as usual. So how do they work? Well, the 'a' parameter is the new value of the variable, and the 'b' parameter is usually ignored. Ie: SET! 7,0 this sets the '!' variable to 7 The only time 'b' is taken into account is if b equals a special number: if b = -1, the variable is set to the a-parameter of line +a if b = -2, the variable is set to the b-parameter of line +a if b = -3, the new variable is INCREASED by the a-parameter of line +a if b = -4, the new variable is INCREASED by the b-parameter of line +a I know that doesn't make sense, so I'll give a few examples:
SET#   19,0		  // sets # to 19

SET#   7,-1		  // sets # to the a-parameter of line +7

SET#   7,-2		  // sets # to the b-parameter of line +7

SET#   8,-3		  // increases # by the a-parameter of line +8

SET#   8,-4		  // increases # by the b-parameter of line +8
Unless the b-parameter is -1, -2, -3, or -4, it is ignored. ~~~ There are a couple more types of variables. The first type is the letter p followed by a number from 1 to 9.... p1 = represents the line of pointer #1 relative to your current line p2 = ditto for pointer #2 p3 = ditto for pointer #3 p4 = ... etc, all the way down to p9 ie: JUMP 0,p6 This line would jump the current pointer to the current location of p6 [as the line value of p6 is given relative to the line of the current pointer] If the pointer in question doesn't exist (is in stasis), the variable's value is 300. If the 300 isn't checked and is used as 300, remember that saying node 300 (or 600, or 900, or -300, etc) is the same thing as saying node 0. However, this can be distinguished from 0 because, if the pointer DID exist and was at the same line, it would show as 0, not as 300. So if a pX variable is 300, you know that it's in stasis 'pX' variables always return a number in the range 0 to 299 (except for 300 if the pointer is in stasis), so even if you use p7 and pointer #7 is at the node -1 from you, the p7 variable will be 299 instead of -1 Also: you can do the following: p!, p#, p$, pe and pt. This is just the pX variable with another variable representing the pointer number [see the next sections for what 't' and 'e' are]. However if the variable isn't a number 0 to 9, the value 600 is returned [this equates to 0 if used as a line number of course]. This is true even if a variable is not being used. Ie, p2.8 will return 600, as will p10. so: pX = 300 if pointer X is in stasis pX = 600 if X is not an integer 0 to 9 both numbers equate to node +0 if used as line numbers. ~~~ The next variable is 'q' ... 'q' is the current pointer's pointer-number, ie, a number from 1 to 9. If you need to use it, it's there ;P You could do 'pq', but that will always return 0 of course ~~~ The next is 't' - t is an integer 1 through 9 that represents the total number of living pointers at this current moment in your program ~~~ The final variable is 'e'. The pointer dealing with 'e' sees 'e' as the pointer's current energy ie, if the pointer has 5 energy and reads this line: JUMP 0,e It will see it as (for the moment) = JUMP 0,5 ~~~ What happens if variable parameters are edited, added to, etc? COPY 2,7 EDIT -1,$,a+: This will add $ to the a-parameter of the COPY line. The variable '$' is examined and the value for that point in time is used for the addition. If '$' is changed later on, it doesn't magically change the COPY too, the COPY is a set value Likewise: COPY $,7 EDIT -1,3,a+: This will add 3 to the COPY's current a-parameter, which is whatever the variable '$' is currently is, and then make that the new a-parameter. This value becomes set, ie, the '$' part is overwritten with whatever the '$' is at that moment, plus 3 from the EDIT ~~ Also, when dealing with the 'p1' to 'p9' variables and the 'e' variable, the value changes depending on which pointer of which program is viewing the line of code. Keep that in mind.
For extra power in your program, you can use a comparison operator in a parameter. This is denoted with the lowercase letter 'c', followed by underscores separating arguments in the comparison. Like so: c_1_2_3_4_5 There are always 5 arguments, and they must be either numbers or variables (you cannot nest comparisons within comparisons). The comparison as a whole evaluates down to one value, which is taken to be the parameter. It works like so: if 1=2, then the comparison evaluates to 3 if 1>2, then the comparison evaluates to 4 if 1<2, then the comparison evaluates to 5 This is like a variable in that, if the comparison is edited or used for editing, it becomes set in stone as an integer rather than retaining the variability. A quick example: JUMP 0,c_!_3_46_-5_-5 This compares the '!' variable to the number 3. If they are equal, the pointer jumps forward by 46 nodes. Otherwise it jumps backwards 5 Another example: SET$ c_!_#_!_!_#,0 this takes the larger of the two variables '!' and '#' and sets that to the '$' variable A final example: JUMP c_p7_300_7_0_0,c_p7_300_1_-3_-3 if p7 is in stasis, this creates it at node +1, but if p7 already exists, the current pointer jumps backward 3 ~~~ You can use comparisons in the c-parameter of EDIT, like so: EDIT 7,8,c_#_1_a+:_x*@_b^- if # = 1, then 'a+:' is used for the c-param if # > 1, then 'x*@' is used if # < 1, then 'b^-' is used
Like comparisons, math units are chunks of code that take in input and evaluate to a single number. Math units always start with a lower case "m" followed by an equals sign ("=") and then two numbers OR variables separated by an operation symbol. Like this: m=5+3 this evaluates to 5+3, or 8 m=e*7 this evaluates to seven times the pointer's current energy m=!+p# this evaluates to the value '!' plus the line distance to pointer '#' Like comparions, Math Units use the current variable value, etc, and if edited or used for editing, the current value is used, and thus editing a math unit by adding 2 to it will overwrite it with a fixed value. So a Math Unit is made up of 'm=' and then two numbers or variables separated by an operator. What are the operators? + = add the numbers - = first number minus the second * = multiply the numbers % = divide the first by the second, take remainder. If the second number is zero, the first number is outputted instead & = smushes the two numbers together (ie, 5 & 7 = 57) > = takes the greater of the two numbers < = takes the lesser of the two numbers Note: Math Unit input values MUST be numbers OR variables. You cannot nest other Math Units or Comparisons within a Math Unit. HOWEVER, you can have Math Units within Comparions!!! Say that pointer #1 runs the following line of code. It would jump pointer #2 ten nodes forward from pointer #1 JUMP 2,10 But what if you wanted to jump #2 ten nodes forward from itself, ie, from #2 instead of from #1? No problemo! JUMP 2,m=p2+10 Simple and effective ;D take this: JUMP c_m=!+1_#_9_0_0,c_$_5_m=2*e_m=p3+17_m=p3+17 In this convoluted example, it compares the variable '!' plus 1 with the variable '#'. If they are equal, it jumps pointer 9, otherwise it jumps the current pointer. And it jumps this pointer to a different spot depending on '$'. If $ is equal to 5, it jumps it forward from the current pointer by double the 'e' variable, otherwise it jumps it 17 nodes forward from pointer #3. This example was just to demonstrate the Math Unit's power and flexibility :~D You cannot use a Math Unit in an EDIT command's c-parameter, as it would have no use there.
If you did peek, and now you're confused, don't worry, I know that some of this is complicated
COPY 0,1 This is a basic "replicator" program. Analyze it - what does it do? It copies itself (node 0) forward 1 node. Then the pointer advances to the next line, which is exactly the same, and runs that. This program will die after 10 rounds when its energy hits 0. Take this program: FOOD 0,0 JUMP 0,-1 This is a basic "guzzler" program. It adds 3 to its energy supply, then jumps itself backwards 1 (-1 to energy supply), then adds 3, etc, in an infinite loop. It continually gains energy, thus it never dies - but doesn't accomplish much else. Guzzlers can be useful sub-programs but would almost never be alone as a full program in themselves. This: COPY 4,10 EDIT -1,2,b+: FOOD 0,0 JUMP 0,-3 JUMP 0,100 is an example of what I call a "bomber". It drops a "JUMP 0,100" command every other node starting with the node +10 from the COPY. This is in an attempt to (eventually) overwrite an enemy program's lines and send it out 100 into desert of blank nodes (remember, the VNA starts out full of JUMP 0,1 commands before the programs are dropped in) so that its energy is depleted and it dies. You can trace the program line by line to see how it works. Think of the "JUMP 0,100" as a bomb that we're trying to hit the enemy program with. * COPY 4,10 ~ this drops the "bomb" (+4 from the COPY) to a spot +10 from the COPY * EDIT -1,2,b+: ~ this increments the COPY's b-parameter by 2 * FOOD 0,0 ~ this increases energy by 3 * JUMP 0,-3 ~ this jumps back to the beginning of the program Then it happens all over again. Remember that the program copies the "bomb" to a new spot every time because the EDIT command keeps adding 2 to its previous value and it sends the bomb out 2 nodes further each iteration. Perhaps a better choice for a one-line bomb would've been JUMP 0,0 ... this will cause a pointer to keep jumping to itself over and over again until its energy is lost and it dies. However this is probably in the vicinity of its other pointers and is thus more susceptible to being re-overwritten and saved. It's a tradeoff ;D Notice how the FOOD node is placed so that the program stays in an energy equilibrium.
~~~ NUMERICAL SPECIFICATIONS * max program size: 50 nodes * starting distance between programs: random. If P1 is assumed to start at "node 0", then P2 can start anywhere from "node 56" to "node 244" ~~~ Because of the way that VNA 3.0 is set up, much more creativity is endowed upon the coder. There are no simple bomb-commands or other instructions that delete a pointer or send it into stasis - the only way to do this is to deplete its energy to 0. There are numerous ways to do this (such as JUMP 0,100 in the example bomber, or better yet JUMP 0,0) with different advantages to them, and you can create more complex multi-command traps, etc, that suit your program better. General structure is of course different than previous VNAs with the lack of functions in this game, but this solves a lot of problems and makes for a better well-rounded game I think. There's no ubernesting, no megastructures, no paradoxical parameter references. Everything is airtight and simple. I also gave enough functionality for complex programs to be built without functions, so the variety of digital organisms should be pretty explosive
• Why Energy? I introduced energy to throw a monkey wrench into the works :D Programs are less like perfect machines and more like cyberzoa, more like battling virtual creatures, which is more how the game is designed. With the introduction of energy & pointers and the way they fit together, your programs can become both more simple and more complex at the same time, in different ways. With this new element, programs have to fit their environment, not the other way around. • Self-Sustaining? Gone is the day where a program can copy itself around the VNA forever, until the array is a soup of code fragments. In VNA 3.0, many programs have life spans - but this doesn't mean that guzzlers (a self-sustained program that just hides in a couple lines of code) will win... a good program, if it has a life span, has a long one, long enough to bomb to pieces a guzzler before it dies. But the type of program most affected by VNA 3.0 and the introduction of energy is the Hopper. I'm currently under the impression that it's impossible to create a self-sustaining hopper, but I'd be happy to be proved wrong. I just made one that survived 1342 rounds before dying of natural causes (I was cheap and filled all the extra space before the actual program with FOODs, without those it survived 74 rounds lol)... I'm sure someone else can do better ;D • Addendum: the above paragraph was written before I added some of the current features. Now I was able to make an efficient self-replicating hopper that not only sustains itself energy-wise but continually gains energy.
* Something I forgot to do a couple times while testing was to put the 'm=' in front of a Math Unit * One thing you should keep in mind is that each pointer is ran each round, cycled through one at a time. If stasis, skipped. This means that, if pointer #1 creates pointer #7, pointer #7 will take its own move before the round is over. However, if pointer #7 creates pointer #1, pointer #1 won't run until next round * Test your program! ;D My emulator has a handy option where you can check a checkbox to ignore program 2, and it just focuses on P1
Some useful "bombs": Pit Trap: JUMP 0,0 This is a basic bomb, although with a hidden weakness that it keeps the pointer within the bounds of its program and could potentially be repaired, if the program has some sort of repairer pointer for that purpose. Fling Trap: JUMP 0,100 This is a bit riskier but with more potential payoff. The pointer is flung far away from its nest into no-mans-land, where it can decrement to 0 energy or run into another bomb of some sort (such as a Pit Trap) to ensure the process without chance of rescue. Vortext Trap: JUMP 1,1 EDIT -1,1,a+: JUMP 0,-2 This is named such as it vacuums in the other pointers one by one. I'm still not sure whether it's best to use "JUMP 1,0" or "1,1" as the first line. The Vortext Trap isn't completely efficient as, the more pointers bouncing around within it, the faster the number gets incremented and some pointers may be skipped. Also, it takes at least three times longer to properly plant the trap. If you do use it, drop it in reverse order (ie, the last line first, then move backwards) Landmine: COPY 3,-5 EDIT -1,-2,b*: JUMP 0,-2 JUMP 0,0 This one "explodes" when the enemy pointer hits it, spewing pit trap bombs forward and backwards exponentially until the pointer dies. This one forces the captured pointer to contribute to its own program's demise, which is helpful. However, the innocent "-5" has a tendency of growing very fast. There may be a couple ways to fix this, I'll leave it up to you if you want to use it ;D Like the Vortex Trap, you should drop the Landmine in reverse order Other Tips and Tricks * Test your program and make sure your pointers (if you have multiple pointers) work well together. There's no need to use all 9 unless you want to, sometimes that's better for the program, sometimes it slows it down - it depends on the program. But, as for pointers, keep in mind that each round, your pointers are cycled through 1 to 9 and ran, even if they were created earlier in the round by an earlier pointer * Use clever combinations of systems - with VNA 3.0's features, you can do a lot of stuff, and there's probably a way to do what you want, so keep your mind open for new techniques ;D * One thing that VNA 3.0 has more of is lines... the total size is 300 nodes, the distance is 56 to 244
vna3.html and the max program size is 50. It's not as hard to use all 50 nodes. In general it's a good strategy to try to do as many things with as few nodes (less vulnerability), but with multiple pointers, you might still need quite a few lines
VNA 3.0 Emulator
Works very fast and smooth
:)vna3.html If there is a problem uploading or downloading or it doesn't work right, here is the source code:
Spoiler for source code:
* copy ALL of it * open a new text file (in TextEdit, NotePad, etc) * paste it * save as vna3.html or something similar (the important part is ending with .html) * here it is:
<html>

<head>

<title>VNA 3.0 ~ Evolution</title>

<script LANGUAGE="javascript">


/* define global vars */

var vna = new Array();

var fillcode = "JUMP 0,1";

var exclam_1 = 0;

var exclam_2 = 0;

var pound_1 = 0;

var pound_2 = 0;

var dollar = 0;

var gameover = 0;


function doSwitch()

{

getp1 = document.form1.p1.value;

getp2 = document.form1.p2.value;

document.form1.p1.value = getp2;

document.form1.p2.value = getp1;

}


function doClear()

{

document.form1.p1.value = null;

document.form1.p2.value = null;

}


function doRandomStart()

{

/*

56 57 ... 243 244

0 1 ... 187 188

*/

document.form1.startline.value = Math.floor(189*Math.random())+56;

}


function loadArray()

{

var error1="";

var error2="";

if (document.form1.p1.value == "") error1 = "P1 is not specified! ";

var pr1 = new Array();

var pr2 = new Array();

pr1 = document.form1.p1.value.split("\n");

if (document.form1.checky.checked == true && document.form1.p2.value == "") 

{document.form1.p2.value = fillcode;}

else if (document.form1.p2.value == "") {error2 = "P2 is not specified! ";}

pr2 = document.form1.p2.value.split("\n");

var nStart = document.form1.startline.value;

var error3="";

var error4="";

var error5="";

if (pr1.length > 50) error3 = "Program 1 is too long! ";

if (pr2.length > 50) error4 = "Program 2 is too long! ";

error4 = error1 + error3 + error2 + error4;

if (error4 != ""){alert(error4); return;}

if (nStart=="")

{

var rvvx = Math.floor(189*Math.random())+56;

alert("No starting node for P2 given - generating one randomly: "+rvvx);

document.form1.startline.value = rvvx;

nStart = rvvx;

}

nStart *= 1;

nStart = doMod(nStart);

var iString;

for (i=0;i<300;i++)

{

iString = fillcode;

if (i<pr1.length) {iString = pr1[i];}

if (i>=nStart && i<nStart+pr2.length) {iString = pr2[i - nStart];}

if (iString == undefined) iString = fillcode;

vna[i] = iString;

}

document.form1.vnarray.value = vna.join("\n");

document.form1.pt1_1.value = "0;10";

if (document.form1.checky.checked == false) {document.form1.pt2_1.value = nStart + ";10";}

else {document.form1.pt2_1.value = "stasis";}

// 9 through 26: element index for the 18 pointers

// alternates pt1_x and pt2_x

for (iq=11;iq<27;iq++)

{

document.form1.elements[iq].value = "stasis";

}

document.form1.rnds.value = 0;

document.form1.dornd.disabled = false;

document.form1.doxrnd.disabled = false;

document.form1.xrd.value = 10;

exclam_1 = 0;

exclam_2 = 0;

pound_1 = 0;

pound_2 = 0;

dollar = 0;

gameover = 0;


}


function doRound()

{

// increment round counter

document.form1.rnds.value++;

// P1 runs pointers 1 - 9

// P2 runs pointers 1 - 9

// skip pointer if in stasis

var zeval;

for (ix=9;ix<26;ix=ix+2)

{

zeval = document.form1.elements[ix].value;

if (zeval != "stasis") runPointer(ix,1);

}

if (document.form1.checky.checked == false)

{

for (ix=10;ix<27;ix=ix+2)

{

zeval = document.form1.elements[ix].value;

if (zeval != "stasis") runPointer(ix,2);

}

}

}


function doXRounds()

{

var getx = document.form1.xrd.value;

for (iv=0;iv<getx;iv++)

{

if (gameover == 0) doRound();

}

}


function doMod(zeinput)

{

while (zeinput < 0)

{

zeinput += 300;

}

zeinput = zeinput % 300;

return zeinput;

}


function runPointer(pointx,playernum)

{

var qstring = document.form1.elements[pointx].value;

var pdata = new Array();

pdata = qstring.split(";");

// line number

var qline = pdata[0]*1;

// energy

var qen = pdata[1]*1;

// aaand we begin!

var sline = vna[qline];

// isolate command

var cmdname = sline.substring(0,4);

var params = sline.substring(5);

pdata = params.split(",");

var parama = pdata[0];

var paramb = pdata[1];

var paramc = "";

if (pdata.length > 2) paramc = pdata[2];

// check for comparisons

if (parama.charAt(0) == "c") parama = doComp(parama,pointx,playernum,qen);

if (paramb.charAt(0) == "c") paramb = doComp(paramb,pointx,playernum,qen);

if (paramc.charAt(0) == "c") paramc = doComp(paramc,pointx,playernum,qen);

// check for p1 to p9

if (parama.charAt(0) == "p") parama = doPvar(parama,pointx,playernum,qen);

if (paramb.charAt(0) == "p") paramb = doPvar(paramb,pointx,playernum,qen);

// check for math units

if ((parama+"").charAt(0) == "m") parama = doMathUnit(parama,pointx,playernum,qen);

if ((paramb+"").charAt(0) == "m") paramb = doMathUnit(paramb,pointx,playernum,qen);

/*if ((paramc+"").charAt(0) == "m") paramc = doMathUnit(paramc,pointx,playernum,qen);*/

// basic variables

if (parama == "!" && playernum == 1) parama = exclam_1;

if (parama == "!" && playernum == 2) parama = exclam_2;

if (parama == "#" && playernum == 1) parama = pound_1;

if (parama == "#" && playernum == 2) parama = pound_2;

if (parama == "$") parama = dollar;

//

if (paramb == "!" && playernum == 1) paramb = exclam_1;

if (paramb == "!" && playernum == 2) paramb = exclam_2;

if (paramb == "#" && playernum == 1) paramb = pound_1;

if (paramb == "#" && playernum == 2) paramb = pound_2;

if (paramb == "$") paramb = dollar;

// check for e

if (parama == "e") parama = qen;

if (paramb == "e") paramb = qen;

// check for q

if (parama == "q") parama = ((pointx - playernum) - 6)/2;

if (paramb == "q") paramb = ((pointx - playernum) - 6)/2;

// check for t

if (parama == "t") parama = sumPointers(playernum);

if (paramb == "t") paramb = sumPointers(playernum);

// parama & paramb are now solid numbers

// paramc only used if EDIT

// switch statement based on cmdname:

cmdname = cmdname.toUpperCase();

parama = parama*1;

paramb = paramb*1;

var nextnode;

var nexten;

switch (cmdname)

{

case "COPY":

var copylinenuma = doMod(qline + parama);

var copylinenumb = doMod(qline + paramb);

vna[copylinenumb] = vna[copylinenuma];

nextnode = doMod(qline + 1);

nexten = qen - 1;

break;

case "JUMP":

var vptest = (parama*2)+6+playernum;

if (parama == 0 || pointx == vptest)

{

nextnode = doMod(qline + paramb);

nexten = qen - 1;

}

else

{

nextnode = doMod(qline + 1);

nexten = qen - 1;

// is the pointer # valid?

var indirecto = 0;

if (parama < 0) {parama = parama * -1; indirecto = 1;}

if (parama == 1 || parama == 2 || parama == 3 || parama == 4 || parama == 5 || parama == 6 || parama == 7 || parama == 8 || parama == 9)

{

// is the pointer in stasis?

var refpoint = (parama*2)+6+playernum;

var refline = document.form1.elements[refpoint].value;

if (refline == "stasis")

{

// create the pointer

var newspot = doMod(qline + paramb);

document.form1.elements[refpoint].value = newspot + ";" + qen;

}

else

{

// move the pointer


var newnode;


//if (indirecto==0)

//{


newnode = doMod(qline + paramb);


//}

//else

//{ 

//var reflinez = refline.substring(0,refline.indexOf(";"));

//reflinez = reflinez*1;

//newnode = doMod(reflinez + paramb);

//}


refline = newnode + ";" + refline.substring(refline.indexOf(";")+1);

document.form1.elements[refpoint].value = refline;

}

}

}

break;

case "EDIT":

var lineofz = doMod(qline + parama);

var stoedit = vna[lineofz];

var charx1 = paramc.charAt(0);

var charx2 = paramc.charAt(1);

var charx3 = paramc.charAt(2);

var editbase;

if (charx3 == ":") editbase = paramb;

if (charx3 == "@" || charx3 == "-" || charx3 == "x")

{

var lineofy = doMod(qline + paramb);

var storef = vna[lineofy];

storef = storef.substring(5);

var okay = new Array();

okay = storef.split(",");

var okayr;

if (charx3=="@" || charx3=="x") okayr = okay[0];

if (charx3=="-") okayr = okay[1];

// evaluate okayr into a number

if (okayr.charAt(0) == "c") okayr = doComp(okayr,pointx,playernum,qen);

if (okayr.charAt(0) == "p") okayr = doPvar(okayr,pointx,playernum,qen);

if ((okayr+"").charAt(0) == "m") okayr = doMathUnit(okayr,pointx,playernum,qen);

if (okayr == "!" && playernum == 1) okayr = exclam_1;

if (okayr == "!" && playernum == 2) okayr = exclam_2;

if (okayr == "#" && playernum == 1) okayr = pound_1;

if (okayr == "#" && playernum == 2) okayr = pound_2;

if (okayr == "$") okayr = dollar;

if (okayr == "e") okayr = qen;

if (okayr == "q") okayr = ((pointx - playernum) - 6)/2;

if (okayr == "t") okayr = sumPointers(playernum);

okayr = okayr*1;

//

editbase = okayr;

}

var editbase2 = editbase;

sstoedit = stoedit.substring(5);

var rifty = new Array();

rifty = sstoedit.split(",");

var riftydos;

var nuline;

// take editbase and change it based on charx2 and existing parameter

if (charx1 == "a" || charx1 == "x")

{

riftydos = rifty[0];

// evaluate riftydos into a number

if (riftydos.charAt(0) == "c") riftydos = doComp(riftydos,pointx,playernum,qen);

if (riftydos.charAt(0) == "p") riftydos = doPvar(riftydos,pointx,playernum,qen);

if ((riftydos+"").charAt(0) == "m") riftydos = doMathUnit(riftydos,pointx,playernum,qen);

if (riftydos == "!" && playernum == 1) riftydos = exclam_1;

if (riftydos == "!" && playernum == 2) riftydos = exclam_2;

if (riftydos == "#" && playernum == 1) riftydos = pound_1;

if (riftydos == "#" && playernum == 2) riftydos = pound_2;

if (riftydos == "$") riftydos = dollar;

if (riftydos == "e") riftydos = qen;

if (riftydos == "q") riftydos = ((pointx - playernum) - 6)/2;

if (riftydos == "t") riftydos = sumPointers(playernum);

riftydos = riftydos*1;

//

switch (charx2)

{

//case "~": editbase = editbase; //lol

case "+": editbase = editbase + riftydos; break;

case "*": editbase = editbase * riftydos; break;

case "%": if (editbase != 0) editbase = riftydos % editbase; break;

case "/": if (riftydos != 0) editbase = editbase % riftydos; break;

case "&": editbase = riftydos + "" + editbase; editbase = editbase*1; break;

case "^": editbase = editbase + "" + riftydos; editbase = editbase*1; 

break;

case ">": editbase = Math.max(editbase,riftydos); break;

case "<": editbase = Math.min(editbase,riftydos); break;

}

nuline = stoedit.substring(0,5) + editbase + "," + rifty[1];

if (rifty.length > 2) nuline = nuline + "," + rifty[2];

stoedit = nuline;

sstoedit = stoedit.substring(5);

var rifty = new Array();

rifty = sstoedit.split(",");

}

if (charx1 == "b" || charx1 == "x")

{

if (charx3=="x")

{

okayr = okay[1];

// evaluate okayr into a number

if (okayr.charAt(0) == "c") okayr = doComp(okayr,pointx,playernum,qen);

if (okayr.charAt(0) == "p") okayr = doPvar(okayr,pointx,playernum,qen);

if ((okayr+"").charAt(0) == "m") okayr = doMathUnit(okayr,pointx,playernum,qen);

if (okayr == "!" && playernum == 1) okayr = exclam_1;

if (okayr == "!" && playernum == 2) okayr = exclam_2;

if (okayr == "#" && playernum == 1) okayr = pound_1;

if (okayr == "#" && playernum == 2) okayr = pound_2;

if (okayr == "$") okayr = dollar;

if (okayr == "e") okayr = qen;

if (okayr == "q") okayr = ((pointx - playernum) - 6)/2;

if (okayr == "t") okayr = sumPointers(playernum);

okayr = okayr*1;

//

editbase = okayr;

}

else {editbase = editbase2;}

riftydos = rifty[1];

// evaluate riftydos into a number

if (riftydos.charAt(0) == "c") riftydos = doComp(riftydos,pointx,playernum,qen);

if (riftydos.charAt(0) == "p") riftydos = doPvar(riftydos,pointx,playernum,qen);

if ((riftydos+"").charAt(0) == "m") riftydos = doMathUnit(riftydos,pointx,playernum,qen);

if (riftydos == "!" && playernum == 1) riftydos = exclam_1;

if (riftydos == "!" && playernum == 2) riftydos = exclam_2;

if (riftydos == "#" && playernum == 1) riftydos = pound_1;

if (riftydos == "#" && playernum == 2) riftydos = pound_2;

if (riftydos == "$") riftydos = dollar;

if (riftydos == "e") riftydos = qen;

if (riftydos == "q") riftydos = ((pointx - playernum) - 6)/2;

if (riftydos == "t") riftydos = sumPointers(playernum);

riftydos = riftydos*1;

//

switch (charx2)

{

//case "~": editbase = editbase;

case "+": editbase = editbase + riftydos; break;

case "*": editbase = editbase * riftydos; break;

case "%": editbase = riftydos % editbase; break;

case "/": editbase = editbase % riftydos; break;

case "&": editbase = riftydos + "" + editbase; editbase = editbase*1; break;

case "^": editbase = editbase + "" + riftydos; editbase = editbase*1; break;

case ">": editbase = Math.max(editbase,riftydos); break;

case "<": editbase = Math.min(editbase,riftydos); break;

}

nuline = stoedit.substring(0,5) + rifty[0] + "," + editbase;

if (rifty.length > 2) nuline = nuline + "," + rifty[2];

stoedit = nuline;

}

vna[lineofz] = stoedit;

nextnode = doMod(qline + 1);

nexten = qen - 1;

break;

case "FOOD":

nextnode = doMod(qline + 1);

nexten = qen + 3;

break;

case "SET!":

case "SET#":

case "SET$":

// set a variable

switch (paramb)

{

case 1:

// left over from development days before the math unit

// to do SETX y,1 just do SETX m=X+y,0

// but leaving the comma 1 feature in anyway...

if (cmdname == "SET!" && playernum == 1) exclam_1 += parama;

if (cmdname == "SET!" && playernum == 2) exclam_2 += parama;

if (cmdname == "SET#" && playernum == 1) pound_1 += parama;

if (cmdname == "SET#" && playernum == 2) pound_2 += parama;

if (cmdname == "SET$") dollar += parama;

break;

case -1:

case -2:

case -3:

case -4:

var cline = doMod(qline + parama);

var ccline = vna[cline].substring(5);

var xydata = new Array();

xydata = ccline.split(",");

var wxyz;

if (paramb == -1 || paramb == -3) wxyz = xydata[0];

if (paramb == -2 || paramb == -4) wxyz = xydata[1];

// evaluate wxyz into a number

if (wxyz.charAt(0) == "c") wxyz = doComp(wxyz,pointx,playernum,qen);

if (wxyz.charAt(0) == "p") wxyz = doPvar(wxyz,pointx,playernum,qen);

if ((wxyz+"").charAt(0) == "m") wxyz = doMathUnit(wxyz,pointx,playernum,qen);

if (wxyz == "!" && playernum == 1) wxyz = exclam_1;

if (wxyz == "!" && playernum == 2) wxyz = exclam_2;

if (wxyz == "#" && playernum == 1) wxyz = pound_1;

if (wxyz == "#" && playernum == 2) wxyz = pound_2;

if (wxyz == "$") wxyz = dollar;

if (wxyz == "e") wxyz = qen;

if (wxyz == "q") wxyz = ((pointx - playernum) - 6)/2;

if (wxyz == "t") wxyz = sumPointers(playernum);

wxyz = wxyz*1;

//

if (paramb > -3)

{

if (cmdname == "SET!" && playernum == 1) exclam_1 = wxyz;

if (cmdname == "SET!" && playernum == 2) exclam_2 = wxyz;

if (cmdname == "SET#" && playernum == 1) pound_1 = wxyz;

if (cmdname == "SET#" && playernum == 2) pound_2 = wxyz;

if (cmdname == "SET$") dollar = wxyz;

}

else

{

if (cmdname == "SET!" && playernum == 1) exclam_1 += wxyz;

if (cmdname == "SET!" && playernum == 2) exclam_2 += wxyz;

if (cmdname == "SET#" && playernum == 1) pound_1 += wxyz;

if (cmdname == "SET#" && playernum == 2) pound_2 += wxyz;

if (cmdname == "SET$") dollar += wxyz;

}

break;

default:

if (cmdname == "SET!" && playernum == 1) exclam_1 = parama;

if (cmdname == "SET!" && playernum == 2) exclam_2 = parama;

if (cmdname == "SET#" && playernum == 1) pound_1 = parama;

if (cmdname == "SET#" && playernum == 2) pound_2 = parama;

if (cmdname == "SET$") dollar = parama;

break;

}

//

nextnode = doMod(qline + 1);

nexten = qen;

break;

}

// render VNA

document.form1.vnarray.value = vna.join("\n");

// now do some checks

if (nexten < 1)

{

// pointer is dead

document.form1.elements[pointx].value = "stasis";

if (gameover == 0)

{

// check for other living pointers

var pointersdead = 0;

for (iz=(8+playernum);iz<(25+playernum);iz=iz+2)

{

if (document.form1.elements[iz].value == "stasis") pointersdead++;

}

if (pointersdead == 9)

{

// Game Over!

gameover = 1;

var qrnd = document.form1.rnds.value;

if (document.form1.checky.checked == false)

{

if (playernum == 1) alert("Player 2 wins on round "+qrnd+"!!!");

if (playernum == 2) alert("Player 1 wins on round "+qrnd+"!!!");

}

else

{

alert("The program dies on round "+qrnd+"!");

}

document.form1.dornd.disabled = true;

document.form1.doxrnd.disabled = true;

}

}

}

else

{

// update pointer field (node;energy)

document.form1.elements[pointx].value = nextnode + ";" + nexten;

}

}


function doComp(xyz,pointx,playernum,qen)

{

xyz = xyz.substring(2);

var vvv = new Array();

vvv = xyz.split("_");

// make sure vvv[0] and vvv[1] are numbers

//  check for p1 to p9

if (vvv[0].charAt(0) == "p") vvv[0] = doPvar(vvv[0],pointx,playernum,qen);

if (vvv[1].charAt(0) == "p") vvv[1] = doPvar(vvv[1],pointx,playernum,qen);

// math unit

if ((vvv[0]+"").charAt(0) == "m") vvv[0] = doMathUnit(vvv[0],pointx,playernum,qen);

if ((vvv[1]+"").charAt(0) == "m") vvv[1] = doMathUnit(vvv[1],pointx,playernum,qen);

// basic variables

if (vvv[0] == "!" && playernum == 1) vvv[0] = exclam_1;

if (vvv[0] == "!" && playernum == 2) vvv[0] = exclam_2;

if (vvv[0] == "#" && playernum == 1) vvv[0] = pound_1;

if (vvv[0] == "#" && playernum == 2) vvv[0] = pound_2;

if (vvv[0] == "$") vvv[0] = dollar;

//

if (vvv[1] == "!" && playernum == 1) vvv[1] = exclam_1;

if (vvv[1] == "!" && playernum == 2) vvv[1] = exclam_2;

if (vvv[1] == "#" && playernum == 1) vvv[1] = pound_1;

if (vvv[1] == "#" && playernum == 2) vvv[1] = pound_2;

if (vvv[1] == "$") vvv[1] = dollar;

// check for e

if (vvv[0] == "e") vvv[0] = qen;

if (vvv[1] == "e") vvv[1] = qen;

// check for q

if (vvv[0] == "q") vvv[0] = ((pointx - playernum) - 6)/2;

if (vvv[1] == "q") vvv[1] = ((pointx - playernum) - 6)/2;

// check for t

if (vvv[0] == "t") vvv[0] = sumPointers(playernum);

if (vvv[1] == "t") vvv[1] = sumPointers(playernum);

// validate

vvv[0] = vvv[0]*1;

vvv[1] = vvv[1]*1;

// vvv[0,1] are pure numbers now

//

if (vvv[0] == vvv[1])

{

return vvv[2];

}

else if (vvv[0] > vvv[1])

{

return vvv[3];

}

else

{

return vvv[4];

}

}


function doPvar(pvar,pointx,playernum,wxen)

{

if (pvar == "pq") return 0;

pvar = pvar.charAt(1);

// parse if variable

if (pvar == "!" && playernum == 1) pvar = exclam_1;

if (pvar == "!" && playernum == 2) pvar = exclam_2;

if (pvar == "#" && playernum == 1) pvar = pound_1;

if (pvar == "#" && playernum == 2) pvar = pound_2;

if (pvar == "$") pvar = dollar;

if (pvar == "e") pvar = wxen;

if (pvar == "t") pvar = sumPointers(playernum);

// if (pvar == "q") pvar = ((pointx - playernum) - 6)/2;

//

if (pvar != 1 && pvar != 2 && pvar != 3 && pvar != 4 && pvar != 5 && pvar != 6 && pvar != 7 && pvar != 8 && pvar != 9) return 600;

pvar = pvar*1;

pvar = (pvar*2)+6+playernum;

var curline = document.form1.elements[pointx].value;

var desline = document.form1.elements[pvar].value;

if (desline == "stasis") return 300;

var xrz = new Array();

xrz = curline.split(";");

curline = xrz[0]*1;

xrz = desline.split(";");

desline = xrz[0]*1;

return doMod(desline - curline);

}


function doMathUnit(mathstring,pointx,playernum,qen)

{

mathstring = mathstring.substring(2);

var referstring = "+-*%&><";

var qchar;

var zchar;

for (gn=0;gn<referstring.length;gn++)

{

zchar = referstring.charAt(gn);

if (mathstring.indexOf(zchar) != -1) {qchar = zchar; break;}

}

var mathparts = new Array();

mathparts = mathstring.split(qchar);

// turn the math parts into numbers

if (mathparts[0].charAt(0) == "p") mathparts[0] = doPvar(mathparts[0],pointx,playernum,qen);

if (mathparts[0] == "!" && playernum == 1) mathparts[0] = exclam_1;

if (mathparts[0] == "!" && playernum == 2) mathparts[0] = exclam_2;

if (mathparts[0] == "#" && playernum == 1) mathparts[0] = pound_1;

if (mathparts[0] == "#" && playernum == 2) mathparts[0] = pound_2;

if (mathparts[0] == "$") mathparts[0] = dollar;

if (mathparts[0] == "e") mathparts[0] = qen;

if (mathparts[0] == "q") mathparts[0] = ((pointx - playernum) - 6)/2;

if (mathparts[0] == "t") mathparts[0] = sumPointers(playernum);

mathparts[0] = mathparts[0]*1;

//

if (mathparts[1].charAt(0) == "p") mathparts[1] = doPvar(mathparts[1],pointx,playernum,qen);

if (mathparts[1] == "!" && playernum == 1) mathparts[1] = exclam_1;

if (mathparts[1] == "!" && playernum == 2) mathparts[1] = exclam_2;

if (mathparts[1] == "#" && playernum == 1) mathparts[1] = pound_1;

if (mathparts[1] == "#" && playernum == 2) mathparts[1] = pound_2;

if (mathparts[1] == "$") mathparts[1] = dollar;

if (mathparts[1] == "e") mathparts[1] = qen;

if (mathparts[1] == "q") mathparts[1] = ((pointx - playernum) - 6)/2;

if (mathparts[1] == "t") mathparts[1] = sumPointers(playernum);

mathparts[1] = mathparts[1]*1;

//

var retxval;

switch (qchar)

{

case "+": retxval = mathparts[0] + mathparts[1]; break;

case "-": retxval = mathparts[0] - mathparts[1]; break;

case "*": retxval = mathparts[0] * mathparts[1]; break;

case "%":

if (mathparts[1] != 0)

{retxval = mathparts[0] % mathparts[1];}

else {retxval = mathparts[0];}

break;

case "&": retxval = mathparts[0] + "" + mathparts[1]; retxval *= 1; break;

case ">": retxval = Math.max(mathparts[0],mathparts[1]); break;

case "<": retxval = Math.min(mathparts[0],mathparts[1]); break;

}

return retxval;

}


function sumPointers(pnum)

{

var pointercount = 0;

for (izz=(8+pnum);izz<(25+pnum);izz=izz+2)

{

if (document.form1.elements[izz].value != "stasis") pointercount++;

}

return pointercount;

}


function showVars()

{

alert("VARIABLES: \n! (P1) = "+exclam_1+"\n! (P2) = "+exclam_2+"\n# (P1) = "+pound_1+"\n# (P2) = "+pound_2+"\n$ = "+dollar);

}


function showHelp()

{

alert("HELP: \n* Put the two programs in the P1 and P2 text fields\n* You can use the 'Switch' and 'Clear' buttons to switch and clear the P1 & P2 fields respectively\n* If you check the checkbox, only P1 will run (though P2 will still be put into the VNA if you put something for it). This is helpful for debugging a program or seeing when/if it dies of natural causes\n* Enter a number for P2 starting node in the range given, or click the button to generate one randomly\n* Click the load button to initialize everything\n* After that, you can see the VNA as well as pointer statistics and rounds. A pointer has its node reference on the first number, then a semicolon, then its energy\n* To do a round, click the Do 1 Round button\n* To do multiple rounds at a time, enter a value for X (default is 10) and click the 'Do X Rounds' button\n* To see the variables in their current state, click the 'See Variables' button\n* To change the number of rows displayed of the VNA, click the button in the bottom right corner. The default is 40, though I choose 15-20 if I want to see all the data at once - choose what works best for you and your browser\n* To get a line number after the VNA is filled, place the cursor in the middle of the line and look at the text field on the bottom. It's kind of a slow feature though\n* Enjoy;D");

}


function changeArrayH()

{

var newheight = prompt("New textarea height (in rows):",document.form1.vnarray.rows);

if (newheight != 0 && newheight != null) document.form1.vnarray.rows = newheight;

}


function doClickArray()

{

var objx = document.form1.vnarray;

var xout;

if(objx.selectionStart)

{

/*

if doesn't work, delete this func, and onClick of vnarray, and the text & input before div right

*/

var startx = objx.selectionStart;

var newlcount = 0;

for (trx=0;trx<startx;trx++)

{

if (objx.value.charAt(trx) == "\n") newlcount++;

}

xout = newlcount;

}

else

{

xout = "Need Firefox & Filled VNA";

}

document.form1.curatline.value = xout;

}



</script>

</head>

<body>

<h1>VNA 3.0 Emulator, by unreality</h1><form name="form1"><br><br><br>P1 ................................................................................

..........................P2<br>


<textarea name="p1" rows=10 cols=50></textarea>

<textarea name="p2" rows=10 cols=50></textarea>

<br>

<center>

<input type="button" value="Switch" onClick="doSwitch();">

<input type="button" value="Clear" onClick="doClear();"> ... <input type="checkbox" name="checky"> Check if just testing P1 [no P2]</center>

<br><br><br><br>

P1 starts at line 0 and goes first<br>

P2 starts at line X and goes second<br>

X: <input type="text" name="startline" length="10">

 <input type="button" value="Random" onClick="doRandomStart();">

<br>(range 56 to 244 please)

<br><br><br><br>

<input type="button" value="Load the Virtual Node Array!" onClick="loadArray();"><br><hr><br>

VNA:<br>

<textarea name="vnarray" onClick="doClickArray();" rows=40 cols=60></textarea><br>

P1_1: <input type="text" name="pt1_1" length="10"> .... P2_1: <input type="text" name="pt2_1" length="10"><br>

P1_2: <input type="text" name="pt1_2" length="10"> .... P2_2: <input type="text" name="pt2_2" length="10"><br>

P1_3: <input type="text" name="pt1_3" length="10"> .... P2_3: <input type="text" name="pt2_3" length="10"><br>

P1_4: <input type="text" name="pt1_4" length="10"> .... P2_4: <input type="text" name="pt2_4" length="10"><br>

P1_5: <input type="text" name="pt1_5" length="10"> .... P2_5: <input type="text" name="pt2_5" length="10"><br>

P1_6: <input type="text" name="pt1_6" length="10"> .... P2_6: <input type="text" name="pt2_6" length="10"><br>

P1_7: <input type="text" name="pt1_7" length="10"> .... P2_7: <input type="text" name="pt2_7" length="10"><br>

P1_8: <input type="text" name="pt1_8" length="10"> .... P2_8: <input type="text" name="pt2_8" length="10"><br>

P1_9: <input type="text" name="pt1_9" length="10"> .... P2_9: <input type="text" name="pt2_9" length="10"><br>


<center>

<input type="button" value="Do 1 Round" name = "dornd" onClick="doRound();"> <input type="button" value="Do X Rounds" name="doxrnd" onClick="doXRounds();"> X:<input type="text" name="xrd" length="10"></center><br>

Rounds: <input type="text" name="rnds" length="10"> <center> <input type="button" value="See Variables" onClick="showVars();"> <input type="button" value="Help" onClick="showHelp();"></center><br><div align="right"><input type="button" value="Change VNA textarea height" onClick="changeArrayH();"></div><br>Cursor Located at Line: <input type="text" name="curatline" length="12"> <font size=1>(Warning - this feature is slow, lol)</font>

</form>

</body>

</html>

When you want to use it, just drag the .html file onto your web browser!

~ Note that my code uses a method called .split which is not supported by Netscape 2 and Explorer 3

~ Also, if you find any bugs/errors in the emulator, please PM me immediately ;D

Link to comment
Share on other sites

  • Answers 55
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Posted Images

Recommended Posts

  • 0

Another one using a similar concept to Slave Driver:

This one, "Broodmother" uses pointer 1 to spread the other pointers around the VNA with the hopes that they will get inside an enemy loop, then p1 nukes each other pointer. Rinse, Repeat. I used a loop to do the nukes: there are faster ways but this probably more compact.

This one seems to win consistently against all the stationary nukers and usually stalemates or beats hoppers. I need some new opponent programs.

A note on strategy: I think using mobile pointers to do your nuking is stronger than tossing bombs with simple copy commands. Even if your primary program gets nuked or overwritten, its likely you got a pointer into their loop and you will stalemate. Hence you never lose, even if you dont always win.

SET! 2,0

FOOD 0,0

FOOD 0,0

JUMP 0,c_e_30_1_1_-2

JUMP m=q+1,0

JUMP 0,c_q_1_1_m=q*29_1

SET! m=!+1,0

COPY 2,p!

JUMP 0,c_!_9_-8_-8_-2

COPY 0,1

Link to comment
Share on other sites

  • 0

:D :D :D :D :D :D :D :D It's great to see you playing VNA, but i was wondering what version of speedy you were fighting. The one in my signature is the correct one and the last version i post on this forum is defective. When i did the battles speedy only lost once and that was to broodmother. I have taken much time to look at your programs, but your defintely off to a good start.

Edit:

unreality hows speedy 2.0 coming? it should be amazing after this long of a wait. :P

Edited by dms172
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...