Jump to content
BrainDen.com - Brain Teasers
  • 0
Sign in to follow this  
unreality

Question

VNA.4

~ Based on VNA/VNA2/VNA3, but you don't need to know anything about those. This is entirely redesigned and simplified ~

Download the VNA.4 emulator, written in HTML/Javascript that runs fine on Firefox 2.0.0.14, Firefox 3.5.1, Safari 1.3 (v312), and Chrome 2.0.172.37 (and 2.0.172.39). It appears to not be working in Internet Explorer whatsoever.

For some reason I can't get the html file to upload... the solution I guess is to post the code verbatim:


<html>

<head>

<title>VNA.4 Emulator, by unreality</title>

<script LANGUAGE="JavaScript">


/* global declarations */


var vna = new Array();

var alphastring = "abcdefghijklmnopqrstuvwxyz";

var capalphastring = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

var p1vararray = new Array(26);

var p2vararray = new Array(26);


/* functions */


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()

{

document.form1.startline.value = Math.floor(117*Math.random())+42

}


function loadArray()

{

var pr1 = new Array();

var pr2 = new Array();

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

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

var nStart = document.form1.startline.value;

var error1="";

var error2="";

var error3="";

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

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

if (nStart=="") error3 = "You must specify a starting node for P2!";

error3 = error1 + error2 + error3;

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

var iString;

var cString = document.form1.fillwith.value;

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

{

iString = cString;

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

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

if (iString == undefined) iString = cString;

vna[i] = iString;

}

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

document.form1.point1.value = 0;

document.form1.point2.value = nStart;

document.form1.rnds.value = 0;

document.form1.dornd.disabled = false;

document.form1.doxrnd.disabled = false;

document.form1.xrd.value = 10;

// fill variable arrays

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

{

p1vararray[i] = 0;

p2vararray[i] = 0;

}

document.form1.seevars.disabled = false;

}


function doRound()

{

// increment round counter

document.form1.rnds.value++;

// pointer locations

var lineOne = document.form1.point1.value*1;

var lineTwo = document.form1.point2.value*1;

// P1 first

var zline = vna[lineOne].toLowerCase();

// count the number of spaces in zline

var chratloopy = 0;

var numspaces = 0;

while (chratloopy < zline.length)

{

if (zline.charAt(chratloopy) == " ") numspaces++;

chratloopy++;

}

var newline;

var paramz = zline.split(" ");

var valqa = doFunc(paramz[0]+"",lineOne,1)*1;

if (numspaces > 0) var valqb = doFunc(paramz[1]+"",lineOne,1)*1;

if (numspaces > 1) var valqc = doFunc(paramz[2]+"",lineOne,1)*1;

if (numspaces > 2) var valqd = doFunc(paramz[3]+"",lineOne,1);

if (numspaces > 3) var valqe = doFunc(paramz[4]+"",lineOne,1);

if (valqd != "!") valqd *= 1;

if (valqe != "!") valqe *= 1;

switch (numspaces)

{

case 0:

if (zline == "x")

{

document.form1.dornd.disabled = true;

document.form1.doxrnd.disabled = true;

alert("Program 2 wins!");

return;

}

else

{

newline = doMod(lineOne + valqa);

}

break;

case 1:

var firstchar = zline.charAt(0);

p1vararray[alphastring.indexOf(firstchar)] = valqb;

newline = doMod(lineOne + 1);

break;

case 2:

var replacestring = vna[doMod(lineOne+valqa)];

// check for capital variables

var zzingl;

var dropfwhenzero = 1;

while (dropfwhenzero == 1)

{

zzingl = replacestring.length;

dropfwhenzero = 0;

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

{

if (capalphastring.indexOf(replacestring.charAt(i)) != -1)

{

replacestring = replacestring.substring(0,i) + p1vararray[capalphastring.indexOf(replacestring.charAt(i))] + replacestring.substring(i+1);

dropfwhenzero = 1;

}

}

}

vna[doMod(lineOne+valqb)] = replacestring;

newline = doMod(lineOne + valqc);

break;

case 3:

var temptemptemp = vna[doMod(valqa + lineOne)];

vna[doMod(valqa + lineOne)] = vna[doMod(valqb + lineOne)];

vna[doMod(valqb + lineOne)] = temptemptemp;

if (vna[doMod(valqa + lineOne)] == vna[doMod(valqb + lineOne)])

{

newline = doMod(lineOne + valqc);

}

else

{

if (valqd != "!") newline = doMod(lineOne + valqd);

if (valqd == "!") newline = doMod(lineOne + valqc);

}

break;

case 4:

if (valqa == valqb) {newline = doMod(lineOne + valqc);}

if (valqa > valqb) {newline = doMod(lineOne + valqd);}

if (valqa < valqb && valqe == "!") {newline = doMod(lineOne + valqd);}

if (valqa < valqb && valqe != "!") {newline = doMod(lineOne + valqe);}

break;

}

//

//

// P2 now

//

//

var zline = vna[lineTwo].toLowerCase();

// count the number of spaces in zline

var chratloopy = 0;

var numspaces = 0;

while (chratloopy < zline.length)

{

if (zline.charAt(chratloopy) == " ") numspaces++;

chratloopy++;

}

var newxline;

paramz = zline.split(" ");

valqa = doFunc(paramz[0]+"",lineTwo,2)*1;

if (numspaces > 0) var valqb = doFunc(paramz[1]+"",lineTwo,1)*1;

if (numspaces > 1) var valqc = doFunc(paramz[2]+"",lineTwo,1)*1;

if (numspaces > 2) var valqd = doFunc(paramz[3]+"",lineTwo,1);

if (numspaces > 3) var valqe = doFunc(paramz[4]+"",lineTwo,1);

if (valqd != "!") valqd *= 1;

if (valqe != "!") valqe *= 1;

switch (numspaces)

{

case 0:

if (zline == "x")

{

document.form1.dornd.disabled = true;

document.form1.doxrnd.disabled = true;

alert("Program 1 wins!");

return;

}

else

{

newxline = doMod(lineTwo + valqa);

}

break;

case 1:

firstchar = zline.charAt(0);

p2vararray[alphastring.indexOf(firstchar)] = valqb;

newxline = doMod(lineTwo + 1);

break;

case 2:

vna[doMod(lineTwo+valqb)] = vna[doMod(lineTwo+valqa)];

newxline = doMod(valqc+lineTwo);

break;

case 3:

var temptemptemp = vna[doMod(valqa + lineTwo)];

vna[doMod(valqa + lineTwo)] = vna[doMod(valqb + lineTwo)];

vna[doMod(valqb + lineTwo)] = temptemptemp;

if (vna[doMod(valqa + lineTwo)] == vna[doMod(valqb + lineTwo)])

{

newxline = doMod(lineTwo + valqc);

}

else

{

if (valqd != "!") newxline = doMod(lineTwo + valqd);

if (valqd == "!") newxline = doMod(lineTwo + valqc);

}

break;

case 4:

if (valqa == valqb) {newxline = doMod(lineTwo + valqc);}

if (valqa > valqb) {newxline = doMod(lineTwo + valqd);}

if (valqa < valqb && valqe == "!") {newxline = doMod(lineTwo + valqd);}

if (valqa < valqb && valqe != "!") {newxline = doMod(lineTwo + valqe);}

break;

}




// render the VNA

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

document.form1.point1.value = newline;

document.form1.point2.value = newxline;

}



function doMod(zeinput)

{

while (zeinput < 0)

{

zeinput += 200;

}

zeinput = zeinput % 200;

return zeinput;

}


function doFunc(param, qline, zpp)

{

if (param == "") return "";

if (param == "!") return "!";

if (alphastring.indexOf(param) != -1)

{

return doSuperFunc(param, zpp);

}

var tempeval;

var closeparen;

var funcin;

var beforeparstring;

var commaloc;

var parenloc;

var rightloc;

var funcname;

var inputarray = new Array();

/*var xdata = new Array();*/

// loop until param is just a number

while (param*1 != param)

{

closeparen = param.indexOf(")");

openparen = (param.substring(0,closeparen+1)).lastIndexOf("(");

funcin = param.substring(openparen+1,closeparen);

beforeparstring = param.substring(0,openparen);

commaloc = beforeparstring.lastIndexOf(",");

parenloc = beforeparstring.lastIndexOf("(");

rightloc = Math.max(commaloc,parenloc);

funcname = param.substring(rightloc+1,openparen);

funcname = funcname.toLowerCase();

//

/*alert(closeparen+" -- "+openparen+" -- "+commaloc+" -- "+parenloc+" -- "+rightloc+" -- "+zpp+qline); 

alert("Name: "+funcname+", Input: "+funcin);*/

//

inputarray = funcin.split(",");

for (i=0;i<inputarray.length;i++)

{

inputarray[i] = doSuperFunc(inputarray[i],zpp);

}

switch (funcname)

{

case "sum":

case "add":

tempeval = 0;

for (i=0;i<inputarray.length;i++)

{

tempeval += inputarray[i];

}

break;

case "prd":

case "mul":

case "mult":

tempeval = 1;

for (i=0;i<inputarray.length;i++)

{

tempeval *= inputarray[i];

}

break;

case "inc":

case "incr":

tempeval = (inputarray[0] + 1);

break;

case "dec":

case "decr":

tempeval = (inputarray[0] - 1);

break;

case "neg":

tempeval = (inputarray[0] * -1);

break;

case "inv":

if (inputarray[0] == 0) {tempeval = 0} else {tempeval = 1 / inputarray[0];}

break;

case "num":

var linetoterm = vna[doMod(qline + inputarray[0])]+"";

tempeval = 1;

for (i=0;i<linetoterm.length;i++)

{

if (linetoterm.charAt(i) == " ") tempeval++;

}

if (linetoterm == "x") tempeval = 0;

break;

case "mod":

tempeval = (inputarray[0]*1) % (inputarray[1]*1);

break;

case "pow":

tempeval = Math.pow(inputarray[0],inputarray[1]);

break;

case "div":

tempeval = (inputarray[0]*1) / (inputarray[1]*1);

break;

case "sub":

tempeval = (inputarray[0]*1) - (inputarray[1]*1);

break;

case "log":

tempeval = Math.log(inputarray[1]*1) / Math.log(inputarray[0]*1);

break;

case "abs":

tempeval = Math.abs(inputarray[0]);

break;

case "int":

tempeval = Math.floor(inputarray[0]);

break;

}

// replace part of param with tempeval... then loop again

param = param.substring(0,rightloc+1) + tempeval + param.substring(closeparen+1);

}

return param;

}


function doSuperFunc(qwerty, zppp)

{

var qwertest = alphastring.indexOf(qwerty);

if (qwertest != -1)

{

if (zppp == 1) qwerty = p1vararray[qwertest];

if (zppp == 2) qwerty = p2vararray[qwertest];

}

else qwerty *= 1;

return qwerty;

}


function doXRounds()

{

var getx = document.form1.xrd.value;

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

{

doRound();

}

}


function seeVars()

{

var ystr = "P1:\n";

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

{

if (p1vararray[i] != 0) ystr += alphastring.charAt(i)+" = "+p1vararray[i]+"\n";

}

ystr += "\nP2:\n";

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

{

if (p2vararray[i] != 0) ystr += alphastring.charAt(i)+" = "+p2vararray[i]+"\n";

}

alert(ystr);

}


/* end of script */

</script>

</head>


<body>

<h1>VNA.4 Emulator, by unreality</h1>

<br><br><br>P1 ..........................................................................................................P2<br><form name="form1">

<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();"></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 42 to 158 please)

<br><br><br><br><center>Fill with: <input type="text" name="fillwith" length="10" value="x"></center><br><input type="button" value="Load the Virtual Node Array!" onClick="loadArray();"><br><hr><br>

VNA:<br><textarea name="vnarray" rows=30 cols=60></textarea><br>

P1 Pointer: <input type="text" name="point1" length="10"><br>

P2 Pointer: <input type="text" name="point2" length="10"><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"><input type="button" value="See Nonzero Variables" name="seevars" onClick="seeVars();" disabled="true">

</form>

</body>

</html>

Just select all of the above code and copy it, pasting it into a simple text file. Then save the text file as "vna4.html". To run the emulator, just drag the text file onto your browser (for a Mac) or double-click the text file and it will open in your default browser (for Mac or PC) or right-click and select "Open with..." (for a Mac or PC) and then select the browser you want to open it in. Sorry for the inconvenience, I'll try to find out why I can't upload it...

Imagine a world where your senses fail you. There is no sound, no smells. There's nothing to taste and nothing to feel. All you can see is an indecipherable infinite hierarchy of data, echoless chambers of information, architectures of code. This cyberscape is constantly changing with iteration by iteration, programs and viruses and shells warring for memory space and processing power. This is the inside of your computer.

But now, an arena has been set aside... two programs, two warriors, shall duke it out in the Virtual Node Array... the VNA is a linear, circular memory core with 200 "nodes", or lines. You can keep going in any direction forever because of the VNA's circular disposition. Each node in the VNA has some code, mostly numbers with some letters and short words, written in terms and separated by spaces. Short, simple code. I will explain shortly how to design your program, but first, the setup system...

In the beginning,the VNA is empty, constituting either all x's (bombs) or 1's (the command to jump to the next line) or some other simple preset filler. Then, the two warring programs are placed into the VNA, spaced out enough to give each other room.

For example, say this is your program:

a sum(a,3)

1 a -1

Then the VNA, which previously looked like this:

x

x

x

x

x

x

x

x

...etc

will now look like this:

x

x

x

x

a sum(a,3)

1 a -1

x

x

...etc

and your program's "pointer" will be placed at the first line of your program, the ""a sum(a,3)"" line.

When the game begins, P1 (Program/Player 1) will go first, then P2, then P1, etc, in alteration. A single "round" is after both P1 and P2 have gone. The VNA updates after one program executes one line of code (so it updates twice each round).

When a program executes a line of code, it does something, and then "jumps" the pointer to a new line. Lines are always referred to relative to the current line of interest; there is no absolute line numbering. So line 1 is always the next line. Line 0 is always the current line. Line -3 is always the line three behind you. Line 200 is the same thing as line 0, line 201 = line 1 = line 401 = line 601, line 197 = line -3, etc, since the VNA wraps around in a circular pattern.

What the program does is determined by the line of code it executes. There are six "structures" which determine how the program evaluates a line of code.

(0) BOMB structure: x

*** the BOMB structure is always the single letter 'x'. If a program executes a BOMB structure, it will be terminated and the enemy will win. You can handle BOMB structures and move them around, copy them, etc, and as long as you don't execute one, you're fine...

(1) JUMP structure: a

*** this does nothing except jump the pointer to line 'a'

(2) SET structure: a b

*** this sets the variable 'a' to the value 'b', then jumps forward 1 line. You have 26 variables, a-z, and your opponent has 26 variables, a-z. Your variables and your opponent's variables never interact. More on variables in a second

(3) COPY structure: a b c

*** copy the contents of line 'a' into line 'b', overriding what was previously on line 'b'. Then jump the pointer to line 'c'

(4) SWITCH structure: a b c d

*** switch the two lines, 'a' and 'b', then jump to line 'c' if 'a' and 'b' were equal. If 'a' and 'b' are not the same, jump to line 'd'

(5) IF structure: a b c d e

*** compare two quantities, 'a' and 'b'. If a=b, jump to line 'c'. If a>b, jump to line 'd'. If a<b, jump to line 'e'

That's it. With this simple system, many good programs can be written concisely, without many lines. For example, I call this the Hopper:

0 137 137

it copies itself 137 nodes forward, then jumps to this copied line for the next round... so each iteration, it jumps 137 nodes forward in the VNA. However, the Hopper's main drawback (other than that it has no offensive capabilities) is that the enemy can get accidentally overwritten by the Hopper and become a hopper as well, hopping for eternity, neither program winning. This is made unlikely by adding one more term to the program:

0 137 137 137

this new-and-improved Hopper is now based on the SWITCH structure. It switches itself with the node 137 lines ahead and then jumps there (regardless of what the other line is). This means that it doesn't leave behind a "hopper trail" that the enemy can get caught up in.

But the Hopper is an offensively weak program; it takes no self-initiative to attack the enemy. It just jumps around, trying to avoid destruction and hoping the enemy destroys itself. So let's make a new program that rains BOMBs (the letter x) down over the VNA, attempting to hit the enemy's code We'll call this program 'Bomber'. If the enemy pointer executes a line of code that is a BOMB, the enemy's program will terminate, and the Bomber will win, so the goal is to spread bombs around the VNA...

3 sum(a,20) 1

a sum(a,3)

-2

x

what does it do? The first node copies line +3 (the BOMB) to the line denoted by the variable 'a' plus 20 [the function sum(1,2,3,4,...) adds everything inside] and then jumps forward 1 line.

The next line assigns, to the value a, the quantity a plus 3. In other words, it increments 'a' by 3. The next line jumps backwards 2, and the cycle starts all over again, bombing a spot three nodes later each time.

But wait! It is considered inefficient to have more "active lines" (lines that are actually being executed by the program) than you should, for two reasons: (1) The more lines the program is executing, the more susceptible it is to bombing. (2) It takes you longer to do the same task.

So how can we shorten it? By switching the order of the lines and using the COPY structure's built-in jump to go back to the start. This new-and-improved Bomber does exactly the same thing as the old one, but more efficiently:

a sum(a,3)

1 sum(a,16) -1

x

The only function you've seen is the sum() function, and you've only seen it operate on two parameters. But sum() can have any number of entries, and can be substituted with add(), which is the same [just preference which you use].

ie,

sum(a,b,c,d) = add(a,b,c,d)

What other functions are there?

* mul(), mult() and prd() are all the same, and they multiply everything inside. For example, mul(5,2,3) = 30.

* the inc(n) or incr(n) functions will output n+1

* the dec(n) or decr(n) functions will output n-1

* the neg(n) function will output n * -1, ie, negative n

* the inv(n) function will output 1/n, ie, the reciprocal of n

* the mod(n,m) function will output n%m, ie, n modulo m, ie, the remainder when n is divided by m

* the pow(n,m) function will output n^m, ie, n raised to the power of m

* the div(n,m) function will output n/m, ie, n divided by m

* the sub(n,m) function will output n-m, ie, n minus m

* the log(n,m) function will output the logarithm base-n of m

* the abs(n) function will output the absolute value of n

* the int(n) function will output the integer base of n, ie, it will truncate/floor n to the greatest integer less than or equal to n

* the num(n) function will output the number of terms in the line 'n' (relative to the current line of course). num(n) will return 0 if 'n' is a BOMB, 1 for JUMP, 2 for SET, 3 for COPY, 4 for SWITCH, and 5 for IF

You can nest functions within functions and pass variables as parameters to functions. For example:

sum(5,mul(3,mod(8,3)),inv(neg(-.2)),a,inc(inc( B)) )

will output 5 + 3*(8%3) + 1/-(-.2) + a + (b+2) = 5 + 3*2 + 5 + a + b + 2 = a+b+18

ADDITIONAL THINGS

~~~~

What if you want to do a SWITCH structure but the line you jump to after that will be the same no matter what, regardless of whether the switched lines are equal? The answer is simple: in the setup 1 2 3 4, just make the 4th term the exact same as the 3rd term. But what if the term is long and complex or something? Just put a "!" exclamation point for the fourth term, ie:

1 2 3 !

This has no practical effect, it's just a preference thing. For SWITCH, it must be placed in the fourth term, and it just means that the 3rd term is the line that is jumped to, no matter what.

The exclamation point is also usable in the IF structure. If you're using the IF structure a b c d e as a=b or a≠b and thus your fourth term is the same as your fifth term, put an exclamation point for the fifth term:

1 2 3 4 !

This means that, if 1=2, jump to 3. Otherwise, jump to 4. Again, the exclamation point just a convenience thing.

~~~~

What if you want to jump to variable 'x'?

First of all, why use 'x' as a variable? There are plenty of others. But if you're using x for whatever reason, and you want to jump to the line denoted by the number 'x' is representing, you can't just do this:

x

since that's a bomb. However, you can just do:

0 0 x

which is the same thing.

~~~~

When a line is copied by a COPY structure, it is copied verbatim. ie:

1 2 100

7 9 add(a,2)

when run, that will copy the second line EXACTLY AS IT IS. Ie, after the first line is ran, the program will look like this:

1 2 100

7 9 add(a,2)

7 9 add(a,2)

But if you want to make it so that a variable is evaluated before being copied, use a CAPITAL letter. Take this program:

1 2 100

7 9 add(A,2)

say that the variable 'a' had a value of 3 at the time. Then after the first line runs, the program looks like this:

1 2 100

7 9 add(A,2)

7 9 add(3,2)

A capital letter variable has no difference from a lower-case variable when the line is being executed, the only difference from lowercaseness is when the line is being copied... when a line is copied, all of its variables stay variables, unless they are capitalized, in which case they are evaluated then and there for the new line.

By the way, a lone capital X is the same thing as a lower case 'x', ie, a bomb, except that if you copy this X, the result will be a number equal to whatever value your variable 'x' has. This makes 'x' a unique variable in that respect.

So... two programs. One array. 200 nodes... and only one victor. Post your ideas, your programs, declare duels... I've only written two more programs that I haven't posted here, called "Hopping Bomber" (or "Bombing Hopper", not sure which one sounds better ;D) and "Tracker", so you reading this can probably do better than what I've got so far :P The emulator is for download at the top of this post. Have at it, test your programs. If you have any questions, feel free to post here!

Share this post


Link to post
Share on other sites

Recommended Posts

  • 0

Quick question: is there an upper limit on how many lines of code you get to write? It looks like it might be 42.

And you wrote the html yourself? Awesome!

Share this post


Link to post
Share on other sites
  • 0

Quick question: is there an upper limit on how many lines of code you get to write? It looks like it might be 42.

the upper limit is 40 :D And the other program is placed anywhere from 42 to 158 lines from your program's starting node

And you wrote the html yourself? Awesome!

Yes... this one I adapted from my VNA 2.0 emulator (which was in turn based on my original javascript VNA emulator, which was in turn based on my hypercard version) but VNA.4 is quite different from 2.0 so I had to tweak some things :P

Share this post


Link to post
Share on other sites
  • 0

Weird, are you sure the two players' variables don't see each other? I'm getting some awfully unexpected stuff happening.

I was pitting the Bomber against my Brutus Maximus and it looks like P2 is "seeing" P1's "a" variable when it's being set using the sum() command. Behavior switches depending on whether you have Brutus in P1 and Bomber in P2 (Bomber's a is always 4) or Bomber in P1 and Brutus in P2 (Brutus' a is always 4). Other weirdness is going on with the spacing between the bombs too (change the final x in each program to a number like 999 or 888 to make it clearer what's happening).

Here's Brutus Maximus if you want to try it out.

a sum(a,1)

38 sum(41,a) 1

37 sum(44,a) 1

36 sum(47,a) 1

35 sum(50,a) 1

34 sum(53,a) 1

33 sum(56,a) 1

32 sum(59,a) 1

31 sum(62,a) 1

30 sum(65,a) 1

29 sum(68,a) 1

28 sum(71,a) 1

27 sum(74,a) 1

26 sum(77,a) 1

25 sum(80,a) 1

24 sum(83,a) 1

23 sum(86,a) 1

22 sum(89,a) 1

21 sum(92,a) 1

20 sum(95,a) 1

19 sum(98,a) 1

18 sum(101,a) 1

17 sum(104,a) 1

16 sum(107,a) 1

15 sum(110,a) 1

14 sum(113,a) 1

13 sum(116,a) 1

12 sum(119,a) 1

11 sum(122,a) 1

10 sum(125,a) 1

9 sum(128,a) 1

8 sum(131,a) 1

7 sum(134,a) 1

6 sum(137,a) 1

5 sum(140,a) 1

4 sum(143,a) 1

3 sum(146,a) 1

2 sum(149,a) 1

1 sum(152,a) -38

x

Share this post


Link to post
Share on other sites
  • 0

I think I figured out what was going on. In the part where P2's turn takes place, there was the block

// P2 now

//

//

var zline = vna[lineTwo].toLowerCase();

// count the number of spaces in zline

var chratloopy = 0;

var numspaces = 0;

while (chratloopy < zline.length)

{

if (zline.charAt(chratloopy) == " ") numspaces++;

chratloopy++;

}

var newxline;

paramz = zline.split(" ");

valqa = doFunc(paramz[0]+"",lineTwo,2)*1;

if (numspaces > 0) var valqb = doFunc(paramz[1]+"",lineTwo,1)*1;

if (numspaces > 1) var valqc = doFunc(paramz[2]+"",lineTwo,1)*1;

if (numspaces > 2) var valqd = doFunc(paramz[3]+"",lineTwo,1);

if (numspaces > 3) var valqe = doFunc(paramz[4]+"",lineTwo,1);

if (valqd != "!") valqd *= 1;

But the third parameter to doFunc() is supposed to be the player's number, so it ought to be 2 instead of 1

// P2 now

//

//

var zline = vna[lineTwo].toLowerCase();

// count the number of spaces in zline

var chratloopy = 0;

var numspaces = 0;

while (chratloopy < zline.length)

{

if (zline.charAt(chratloopy) == " ") numspaces++;

chratloopy++;

}

var newxline;

paramz = zline.split(" ");

valqa = doFunc(paramz[0]+"",lineTwo,2)*1;

if (numspaces > 0) var valqb = doFunc(paramz[1]+"",lineTwo,2)*1;

if (numspaces > 1) var valqc = doFunc(paramz[2]+"",lineTwo,2)*1;

if (numspaces > 2) var valqd = doFunc(paramz[3]+"",lineTwo,2);

if (numspaces > 3) var valqe = doFunc(paramz[4]+"",lineTwo,2);

if (valqd != "!") valqd *= 1;

Seems to be working as expected now. And Brutus Maximus is kicking some butt.

Share this post


Link to post
Share on other sites
  • 0

yeah thanks for catching that! That was one of the things that I planned to go back through, hopefully that's the last such thing lol ;D


<html>

<head>

<title>VNA.4 Emulator, by unreality</title>

<script LANGUAGE="JavaScript">


/* global declarations */


var vna = new Array();

var alphastring = "abcdefghijklmnopqrstuvwxyz";

var capalphastring = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

var p1vararray = new Array(26);

var p2vararray = new Array(26);


/* functions */


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()

{

document.form1.startline.value = Math.floor(117*Math.random())+42

}


function loadArray()

{

var pr1 = new Array();

var pr2 = new Array();

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

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

var nStart = document.form1.startline.value;

var error1="";

var error2="";

var error3="";

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

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

if (nStart=="") error3 = "You must specify a starting node for P2!";

error3 = error1 + error2 + error3;

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

var iString;

var cString = document.form1.fillwith.value;

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

{

iString = cString;

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

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

if (iString == undefined) iString = cString;

vna[i] = iString;

}

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

document.form1.point1.value = 0;

document.form1.point2.value = nStart;

document.form1.rnds.value = 0;

document.form1.dornd.disabled = false;

document.form1.doxrnd.disabled = false;

document.form1.xrd.value = 10;

// fill variable arrays

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

{

p1vararray[i] = 0;

p2vararray[i] = 0;

}

document.form1.seevars.disabled = false;

}


function doRound()

{

// increment round counter

document.form1.rnds.value++;

// pointer locations

var lineOne = document.form1.point1.value*1;

var lineTwo = document.form1.point2.value*1;

// P1 first

var zline = vna[lineOne].toLowerCase();

// count the number of spaces in zline

var chratloopy = 0;

var numspaces = 0;

while (chratloopy < zline.length)

{

if (zline.charAt(chratloopy) == " ") numspaces++;

chratloopy++;

}

var newline;

var paramz = zline.split(" ");

var valqa = doFunc(paramz[0]+"",lineOne,1)*1;

if (numspaces > 0) var valqb = doFunc(paramz[1]+"",lineOne,1)*1;

if (numspaces > 1) var valqc = doFunc(paramz[2]+"",lineOne,1)*1;

if (numspaces > 2) var valqd = doFunc(paramz[3]+"",lineOne,1);

if (numspaces > 3) var valqe = doFunc(paramz[4]+"",lineOne,1);

if (valqd != "!") valqd *= 1;

if (valqe != "!") valqe *= 1;

switch (numspaces)

{

case 0:

if (zline == "x")

{

document.form1.dornd.disabled = true;

document.form1.doxrnd.disabled = true;

alert("Program 2 wins!");

return;

}

else

{

newline = doMod(lineOne + valqa);

}

break;

case 1:

var firstchar = zline.charAt(0);

p1vararray[alphastring.indexOf(firstchar)] = valqb;

newline = doMod(lineOne + 1);

break;

case 2:

var replacestring = vna[doMod(lineOne+valqa)];

// check for capital variables

var zzingl;

var dropfwhenzero = 1;

while (dropfwhenzero == 1)

{

zzingl = replacestring.length;

dropfwhenzero = 0;

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

{

if (capalphastring.indexOf(replacestring.charAt(i)) != -1)

{

replacestring = replacestring.substring(0,i) + p1vararray[capalphastring.indexOf(replacestring.charAt(i))] + replacestring.substring(i+1);

dropfwhenzero = 1;

}

}

}

vna[doMod(lineOne+valqb)] = replacestring;

newline = doMod(lineOne + valqc);

break;

case 3:

var temptemptemp = vna[doMod(valqa + lineOne)];

vna[doMod(valqa + lineOne)] = vna[doMod(valqb + lineOne)];

vna[doMod(valqb + lineOne)] = temptemptemp;

if (vna[doMod(valqa + lineOne)] == vna[doMod(valqb + lineOne)])

{

newline = doMod(lineOne + valqc);

}

else

{

if (valqd != "!") newline = doMod(lineOne + valqd);

if (valqd == "!") newline = doMod(lineOne + valqc);

}

break;

case 4:

if (valqa == valqb) {newline = doMod(lineOne + valqc);}

if (valqa > valqb) {newline = doMod(lineOne + valqd);}

if (valqa < valqb && valqe == "!") {newline = doMod(lineOne + valqd);}

if (valqa < valqb && valqe != "!") {newline = doMod(lineOne + valqe);}

break;

}

//

//

// P2 now

//

//

var zline = vna[lineTwo].toLowerCase();

// count the number of spaces in zline

var chratloopy = 0;

var numspaces = 0;

while (chratloopy < zline.length)

{

if (zline.charAt(chratloopy) == " ") numspaces++;

chratloopy++;

}

var newxline;

paramz = zline.split(" ");

valqa = doFunc(paramz[0]+"",lineTwo,2)*1;

if (numspaces > 0) var valqb = doFunc(paramz[1]+"",lineTwo,2)*1;

if (numspaces > 1) var valqc = doFunc(paramz[2]+"",lineTwo,2)*1;

if (numspaces > 2) var valqd = doFunc(paramz[3]+"",lineTwo,2);

if (numspaces > 3) var valqe = doFunc(paramz[4]+"",lineTwo,2);

if (valqd != "!") valqd *= 1;

if (valqe != "!") valqe *= 1;

switch (numspaces)

{

case 0:

if (zline == "x")

{

document.form1.dornd.disabled = true;

document.form1.doxrnd.disabled = true;

alert("Program 1 wins!");

return;

}

else

{

newxline = doMod(lineTwo + valqa);

}

break;

case 1:

firstchar = zline.charAt(0);

p2vararray[alphastring.indexOf(firstchar)] = valqb;

newxline = doMod(lineTwo + 1);

break;

case 2:

vna[doMod(lineTwo+valqb)] = vna[doMod(lineTwo+valqa)];

newxline = doMod(valqc+lineTwo);

break;

case 3:

var temptemptemp = vna[doMod(valqa + lineTwo)];

vna[doMod(valqa + lineTwo)] = vna[doMod(valqb + lineTwo)];

vna[doMod(valqb + lineTwo)] = temptemptemp;

if (vna[doMod(valqa + lineTwo)] == vna[doMod(valqb + lineTwo)])

{

newxline = doMod(lineTwo + valqc);

}

else

{

if (valqd != "!") newxline = doMod(lineTwo + valqd);

if (valqd == "!") newxline = doMod(lineTwo + valqc);

}

break;

case 4:

if (valqa == valqb) {newxline = doMod(lineTwo + valqc);}

if (valqa > valqb) {newxline = doMod(lineTwo + valqd);}

if (valqa < valqb && valqe == "!") {newxline = doMod(lineTwo + valqd);}

if (valqa < valqb && valqe != "!") {newxline = doMod(lineTwo + valqe);}

break;

}




// render the VNA

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

document.form1.point1.value = newline;

document.form1.point2.value = newxline;

}



function doMod(zeinput)

{

while (zeinput < 0)

{

zeinput += 200;

}

zeinput = zeinput % 200;

return zeinput;

}


function doFunc(param, qline, zpp)

{

if (param == "") return "";

if (param == "!") return "!";

if (alphastring.indexOf(param) != -1)

{

return doSuperFunc(param, zpp);

}

var tempeval;

var closeparen;

var funcin;

var beforeparstring;

var commaloc;

var parenloc;

var rightloc;

var funcname;

var inputarray = new Array();

/*var xdata = new Array();*/

// loop until param is just a number

while (param*1 != param)

{

closeparen = param.indexOf(")");

openparen = (param.substring(0,closeparen+1)).lastIndexOf("(");

funcin = param.substring(openparen+1,closeparen);

beforeparstring = param.substring(0,openparen);

commaloc = beforeparstring.lastIndexOf(",");

parenloc = beforeparstring.lastIndexOf("(");

rightloc = Math.max(commaloc,parenloc);

funcname = param.substring(rightloc+1,openparen);

funcname = funcname.toLowerCase();

//

/*alert(closeparen+" -- "+openparen+" -- "+commaloc+" -- "+parenloc+" -- "+rightloc+" -- "+zpp+qline); 

alert("Name: "+funcname+", Input: "+funcin);*/

//

inputarray = funcin.split(",");

for (i=0;i<inputarray.length;i++)

{

inputarray[i] = doSuperFunc(inputarray[i],zpp);

}

switch (funcname)

{

case "sum":

case "add":

tempeval = 0;

for (i=0;i<inputarray.length;i++)

{

tempeval += inputarray[i];

}

break;

case "prd":

case "mul":

case "mult":

tempeval = 1;

for (i=0;i<inputarray.length;i++)

{

tempeval *= inputarray[i];

}

break;

case "inc":

case "incr":

tempeval = (inputarray[0] + 1);

break;

case "dec":

case "decr":

tempeval = (inputarray[0] - 1);

break;

case "neg":

tempeval = (inputarray[0] * -1);

break;

case "inv":

if (inputarray[0] == 0) {tempeval = 0} else {tempeval = 1 / inputarray[0];}

break;

case "num":

var linetoterm = vna[doMod(qline + inputarray[0])]+"";

tempeval = 1;

for (i=0;i<linetoterm.length;i++)

{

if (linetoterm.charAt(i) == " ") tempeval++;

}

if (linetoterm == "x") tempeval = 0;

break;

case "mod":

tempeval = (inputarray[0]*1) % (inputarray[1]*1);

break;

case "pow":

tempeval = Math.pow(inputarray[0],inputarray[1]);

break;

case "div":

tempeval = (inputarray[0]*1) / (inputarray[1]*1);

break;

case "sub":

tempeval = (inputarray[0]*1) - (inputarray[1]*1);

break;

case "log":

tempeval = Math.log(inputarray[1]*1) / Math.log(inputarray[0]*1);

break;

case "abs":

tempeval = Math.abs(inputarray[0]);

break;

case "int":

tempeval = Math.floor(inputarray[0]);

break;

}

// replace part of param with tempeval... then loop again

param = param.substring(0,rightloc+1) + tempeval + param.substring(closeparen+1);

}

return param;

}


function doSuperFunc(qwerty, zppp)

{

var qwertest = alphastring.indexOf(qwerty);

if (qwertest != -1)

{

if (zppp == 1) qwerty = p1vararray[qwertest];

if (zppp == 2) qwerty = p2vararray[qwertest];

}

else qwerty *= 1;

return qwerty;

}


function doXRounds()

{

var getx = document.form1.xrd.value;

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

{

doRound();

}

}


function seeVars()

{

var ystr = "P1:\n";

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

{

if (p1vararray[i] != 0) ystr += alphastring.charAt(i)+" = "+p1vararray[i]+"\n";

}

ystr += "\nP2:\n";

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

{

if (p2vararray[i] != 0) ystr += alphastring.charAt(i)+" = "+p2vararray[i]+"\n";

}

alert(ystr);

}


/* end of script */

</script>

</head>


<body>

<h1>VNA.4 Emulator, by unreality</h1>

<br><br><br>P1 ..........................................................................................................P2<br><form name="form1">

<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();"></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 42 to 158 please)

<br><br><br><br><center>Fill with: <input type="text" name="fillwith" length="10" value="x"></center><br><input type="button" value="Load the Virtual Node Array!" onClick="loadArray();"><br><hr><br>

VNA:<br><textarea name="vnarray" rows=30 cols=60></textarea><br>

P1 Pointer: <input type="text" name="point1" length="10"><br>

P2 Pointer: <input type="text" name="point2" length="10"><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"><input type="button" value="See Nonzero Variables" name="seevars" onClick="seeVars();" disabled="true">

</form>

</body>

</html>

I hadn't noticed it before since most of my tests have been with one program and P2 being '0'. Thanks again :D

Also, 'Do X Rounds' seems to fail depending on the Browser. Safari does it correctly to the best of my knowledge, Firefox only does two or so, and Chrome only one, depending on your comp speed and other factors. So the 'Do X Rounds' isn't so reliable :lol:

and nice program, Brutus Maximus. I have yet to test it out, but looks good. Programs of that type tend to be round-efficient and churn out the most bombs/round, but they have a huge vulnerability downside: A single bomb on any of those lines will cripple the entire program. It's a tradeoff to find the right efficiency-per-danger ratio.

Also, it has another thing you'll want to fix: lines are relative. So that last line is copying 153 from itself but 191 from "line zero" of the program. If you mark one off per line distance from the zeroeth line, you'd have this:

a sum(a,1)

38 sum(40,a) 1

37 sum(42,a) 1

36 sum(44,a) 1

35 sum(46,a) 1

34 sum(48,a) 1

33 sum(50,a) 1

32 sum(52,a) 1

...

etc - the way it works out here is that it goes by twos from 40 instead of threes from 41. Now the numbers you wanted are relative to your line zero :)

I'll post the Hopping Bomber and the Tracker in a bit, first I'm debugging a mathematical program that calculates square roots from the iterative Babylonian method

Share this post


Link to post
Share on other sites
  • 0

Square Rooter

n [NUMBERHERE]

z int(pow(n,.5))

z add(z,div(sub(n,mul(z,z)),inc(mul(2,z))))

z mul(.5,add(z,div(n,z)))

1 2 -1

Z

replace [NUMBERHERE] with a number to square root. The initial seed for z is based on my own theorem, after that the Babylonian method is used to converge extremely quickly to the desired value ;D Also the int(pow(n,.5)) in the beginning isn't cheating since it's easy to get that floored number by just thinking about it, I wasn't sure how else to express it ;D

some other programs...

Hopping Bomber:

a sum(a,137) 1

a mod(sum(a,1),4)

2 prd(a,50) 1

a 0 134 -3 134

x

Tracker

a 47

a sum(a,3)

num(a) 0 -1 1 -1

a sum(a,-4)

a sum(a,1)

1 a -1

x

Share this post


Link to post
Share on other sites
  • 0

I see what you mean about complexity being detrimental. I tried to write an elaborate, self-diagnosing, self-repairing program, but in practice it only wins when it lucks out and wipes out the other program without having to regenerate :P . I wrote this in a spreadsheet so I could have comments (yeah, I know, such a nerdy programmer)


Command Comment
a sum(a,-3) Initially sets a=-3, then decrements
38 sum(-2,a) 1 bombs
sum(num(-2),num(-1),num(0)) 10 -2 1 1 sees if the opening command set is intact: if so repeat, if not go to Regeneration
sum(num(1),num(2),num(3),num(4),num(5),num(6),num(7)) 24 1 8 8 See if this copy of Regeneration is intact, if so then execute, if not then go to the next copy
4 -4 1 Copy the backup of the original plan back in its original position
4 -4 1
4 -4 1
sum(num(-7),num(-6),num(-5)) 10 -7 4 4 Sees if the original commands were resorted. If so, go to it. If not, go to the next copy of Regeneration
a sum(a,-3)
38 sum(-2,a) 1
sum(num(-2),num(-1),num(0)) 10 -2 1 1
sum(num(1),num(2),num(3),num(4),num(5),num(6),num(7)) 24 1 8 8 See if this copy of Regeneration is intact, if so then execute, if not then go to the next copy
4 -12 1 Copy the backup of the original plan back in its original position
4 -12 1
4 -12 1
sum(num(-15),num(-14),num(-13)) 10 -15 4 4 Sees if the original commands were resorted. If so, go to it. If not, go to the next copy of Regeneration
a sum(a,-3)
38 sum(-2,a) 1
sum(num(-2),num(-1),num(0)) 10 -2 1 1
sum(num(1),num(2),num(3),num(4),num(5),num(6),num(7)) 24 1 8 8 See if this copy of Regeneration is intact, if so then execute, if not then go to the next copy
4 -20 1 Copy the backup of the original plan back in its original position
4 -20 1
4 -20 1
sum(num(-23),num(-22),num(-21)) 10 -23 4 4 Sees if the original commands were resorted. If so, go to it. If not, go to the next copy of Regeneration
a sum(a,-3)
38 sum(-2,a) 1
sum(num(-2),num(-1),num(0)) 10 -2 1 1
sum(num(1),num(2),num(3),num(4),num(5),num(6),num(7)) 24 1 8 8 See if this copy of Regeneration is intact, if so then execute, if not then go to the next copy
4 -28 1 Copy the backup of the original plan back in its original position
4 -28 1
4 -28 1
sum(num(-31),num(-30),num(-29)) 10 -31 4 4 Sees if the original commands were resorted. If so, go to it. If not, go to the next copy of Regeneration
a sum(a,-3)
38 sum(-2,a) -1
sum(num(-2),num(-1)) 5 -2 1 1
a sum(a,-37) If all copies of Regeneration failed, PANIC! BOMB LIKE MAD!
1 a -1
x
x
x da bomb
[/codebox]

Here's just the text that can be pasted into VNA

a sum(a,-3)

38 sum(-2,a) 1

sum(num(-2),num(-1),num(0)) 10 -2 1 1

sum(num(1),num(2),num(3),num(4),num(5),num(6),num(7)) 24 1 8 8

4 -4 1

4 -4 1

4 -4 1

sum(num(-7),num(-6),num(-5)) 10 -7 4 4

a sum(a,-3)

38 sum(-2,a) 1

sum(num(-2),num(-1),num(0)) 10 -2 1 1

sum(num(1),num(2),num(3),num(4),num(5),num(6),num(7)) 24 1 8 8

4 -12 1

4 -12 1

4 -12 1

sum(num(-15),num(-14),num(-13)) 10 -15 4 4

a sum(a,-3)

38 sum(-2,a) 1

sum(num(-2),num(-1),num(0)) 10 -2 1 1

sum(num(1),num(2),num(3),num(4),num(5),num(6),num(7)) 24 1 8 8

4 -20 1

4 -20 1

4 -20 1

sum(num(-23),num(-22),num(-21)) 10 -23 4 4

a sum(a,-3)

38 sum(-2,a) 1

sum(num(-2),num(-1),num(0)) 10 -2 1 1

sum(num(1),num(2),num(3),num(4),num(5),num(6),num(7)) 24 1 8 8

4 -28 1

4 -28 1

4 -28 1

sum(num(-31),num(-30),num(-29)) 10 -31 4 4

a sum(a,-3)

38 sum(-2,a) -1

sum(num(-2),num(-1)) 5 -2 1 1

a sum(a,-37)

1 a -1

x

x

x

Share this post


Link to post
Share on other sites
  • 0

Nice! Something like that was easy in VNA 3.0 with multiple pointers but not here with only one - I'll have to look over the code later when I have more time :) To be honest I haven't thoroughly tested any of these, right now I've just making programs and theorizing, not much testing on the emulator yet... anyway, here's something I was thinking of doing:

z add(mul(mod(z,2),50),137,z) 2

x

z inc(z)

x

z 4 -4 133 -4

it's based off an idea I had of using the modulus as an "if" system within the COPY structure (since there's no com() function, but that could be added, however at the cost of the num() function since the two would be incompatible together via megastructure... com(a,b,c,d,e) would compare a and b. If a=b, the function returns c. If a>b, it outputs d. And e for a<b. But that could only be implimented if we removed num(). Your thoughts?)

anyway... the z inc(z) line of course goes to the bomb and the program dies. So I've been trying to make a new mathematical statement that gives different results for the bombs but allows the SET structure bunched together with the end if structure:

z ... (COPY structure) ... 3

x

x

z inc(z)

z 4 -4 133 -4

I've been experimenting with mod(z,5) with division and flooring, but to no avail yet. But I just had a new idea that could work, by using a modulus on the first term of the COPY structure as well:

add(mul(mod(z,2),3),z) add(mul(mod(z,2),50),137,z) 1

z mod(inc(z),3)

z 0 135 -2 -2

it also covers an error in the other program by resetting z properly to 0 for the next iteration elsewhere. I think this is my best program so far... due to the z variable, I've decided to call it Zebra Warrior :P It alternates bombing and copying itself (starts out by copying the zeroth line, then bombing, then copying the first line, then bombing, etc, jumping away to the new copy of itself when complete).

Zebra Warrior

add(mul(mod(z,2),3),z) add(mul(mod(z,2),50),137,z) 1

z mod(inc(z),3)

z 0 135 -2 -2

Share this post


Link to post
Share on other sites
  • 0
Guest

hate to break you heart guys but, I have to bow out of this one. I dont speak html or greek, wait I do speek greek but, you know what I mean.

Have fun storming the castle boys!

Share this post


Link to post
Share on other sites
  • 0

The zebra does seem pretty slick. I hadn't really gone with the hopping approach myself just because I figured that the programs would be equally likely to get hit no matter where they are. If there were multiple pointers that had to initially start in a small area, that would be a different matter.

The only thing I've noticed is that the probability of winning seems to depend mostly on how fast and furious you can be with throwing bombs. Great for Brutus Maximus, but it kind of leaves me thinking that there's a big penalty for creative programming. It might be nicer if, say, variable assignments took 1 ms, logical operations took 5 ms, writing a line took 100 ms, etc. to give them a chance to compete against a brute force machine. But that might be too complicated to program. What would you think about making it so that only line copying commands cost any time, and if you just execute a variable assignment or logical branchpoint or something you get to keep executing more lines of code until you do a write command?

Edited by plasmid

Share this post


Link to post
Share on other sites
  • 0

Before we do that, I need to fix a fatal flaw in ZW's code... hang on :D

Meanwhile I made a good framework for battles:

Six Rounds with Six Seeds: 45, 55, 65, 75, 85, 95. Each of those (+ or -) 5 for a random range of 10 possibilities, ie, the 75 seed can be anywhere from 70-80.

Each round is played with that starting line used for P2, then in a round there are two games, in which the players switch P1/P2 position (and thus also starting location) for the second game. [Edit - the reason we only play in the 45-95 range is because 105 is equivalent to 95, et al, since two games are played and they are flipped for each round]

Anyway let me see to that bug in ZW... also you might want to do the fix I suggested for Brutus Maximus to make it as brute as possible, but either way it's pretty efficient (if highly vulnerable)

Edited by unreality

Share this post


Link to post
Share on other sites
  • 0

this is my fix for Zebra Warrior:

add(mul(mod(z,2),3),div(z,2)) add(mul(mod(z,2),50),137,div(z,2)) 1

z mod(inc(z),3)

z 0 135 -2 -2

I had forgotten to add the div(z,2) for the final added parameter instead of just z. Anyway, in testing this, it folds over a line and (possibly because of this) the emulator comes up with an error that seems out of place. So I have to fix that. And also I will change the 'i' variables in various for-loops to others just in case there's any variable naming scope problems. So when I get time, probably tomorrow, I'll post updated code for the emulator... sorry...

Share this post


Link to post
Share on other sites
  • 0

I did some things to fix any potential scoping problems and also found a gaping error - I forgot to copy over the corrections on the capital-variable stuff into the P2 code... so I just have to do a bit more testing and then I will present the updated, much improved, combat-viable code :) Sorry about the inconvenience... programming is always a journey ;D hehe

Share this post


Link to post
Share on other sites
  • 0

on top of that, here's the updated corrected Zebra Warrior (edit in blue)

Zebra Warrior

add(mul(mod(z,2),3),int(div(z,2))) add(mul(mod(z,2),50),137,int(div(z,2))) 1

z mod(inc(z),5)

z 0 135 -2 -2

aaand the VNA.4 emulator code, corrected and fixed and updated:


<html>

<head>

<title>VNA.4 Emulator, by unreality</title>

<script LANGUAGE="JavaScript">


/* global declarations */


var vna = new Array();

var alphastring = "abcdefghijklmnopqrstuvwxyz";

var capalphastring = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

var p1vararray = new Array(26);

var p2vararray = new Array(26);


/* functions */


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()

{

document.form1.startline.value = Math.floor(117*Math.random())+42

}


function loadArray()

{

var pr1 = new Array();

var pr2 = new Array();

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

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

var nStart = document.form1.startline.value;

var error1="";

var error2="";

var error3="";

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

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

if (nStart=="") error3 = "You must specify a starting node for P2!";

error3 = error1 + error2 + error3;

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

var iString;

var cString = document.form1.fillwith.value;

for (ihh=0;ihh<200;ihh++)

{

iString = cString;

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

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

if (iString == undefined) iString = cString;

vna[ihh] = iString;

}

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

document.form1.point1.value = 0;

document.form1.point2.value = nStart;

document.form1.rnds.value = 0;

document.form1.dornd.disabled = false;

document.form1.doxrnd.disabled = false;

document.form1.xrd.value = 10;

// fill variable arrays

for(iww=0;iww<26;iww++)

{

p1vararray[iww] = 0;

p2vararray[iww] = 0;

}

document.form1.seevars.disabled = false;

}


function doRound()

{

// increment round counter

document.form1.rnds.value++;

// pointer locations

var lineOne = document.form1.point1.value*1;

var lineTwo = document.form1.point2.value*1;

// P1 first

var zline = vna[lineOne].toLowerCase();

// count the number of spaces in zline

var chratloopy = 0;

var numspaces = 0;

while (chratloopy < zline.length)

{

if (zline.charAt(chratloopy) == " ") numspaces++;

chratloopy++;

}

var newline;

var paramz = zline.split(" ");

var valqa = doFunc(paramz[0]+"",lineOne,1)*1;

if (numspaces > 0) var valqb = doFunc(paramz[1]+"",lineOne,1)*1;

if (numspaces > 1) var valqc = doFunc(paramz[2]+"",lineOne,1)*1;

if (numspaces > 2) var valqd = doFunc(paramz[3]+"",lineOne,1);

if (numspaces > 3) var valqe = doFunc(paramz[4]+"",lineOne,1);

if (valqd != "!") valqd *= 1;

if (valqe != "!") valqe *= 1;

switch (numspaces)

{

case 0:

if (zline == "x")

{

document.form1.dornd.disabled = true;

document.form1.doxrnd.disabled = true;

alert("Program 2 wins!");

return;

}

else

{

newline = doMod(lineOne + valqa);

}

break;

case 1:

var firstchar = zline.charAt(0);

p1vararray[alphastring.indexOf(firstchar)] = valqb;

newline = doMod(lineOne + 1);

break;

case 2:

var replacestring = vna[doMod(lineOne+valqa)];

// check for capital variables

var zzingl;

var dropfwhenzero = 1;

while (dropfwhenzero == 1)

{

zzingl = replacestring.length;

dropfwhenzero = 0;

for (eee=0;eee<zzingl;eee++)

{

if (capalphastring.indexOf(replacestring.charAt(eee)) != -1)

{

replacestring = replacestring.substring(0,eee) + p1vararray[capalphastring.indexOf(replacestring.charAt(eee))] + replacestring.substring(eee+1);

dropfwhenzero = 1;

}

}

}

vna[doMod(lineOne+valqb)] = replacestring;

newline = doMod(lineOne + valqc);

break;

case 3:

var temptemptemp = vna[doMod(valqa + lineOne)];

vna[doMod(valqa + lineOne)] = vna[doMod(valqb + lineOne)];

vna[doMod(valqb + lineOne)] = temptemptemp;

if (vna[doMod(valqa + lineOne)] == vna[doMod(valqb + lineOne)])

{

newline = doMod(lineOne + valqc);

}

else

{

if (valqd != "!") newline = doMod(lineOne + valqd);

if (valqd == "!") newline = doMod(lineOne + valqc);

}

break;

case 4:

if (valqa == valqb) {newline = doMod(lineOne + valqc);}

if (valqa > valqb) {newline = doMod(lineOne + valqd);}

if (valqa < valqb && valqe == "!") {newline = doMod(lineOne + valqd);}

if (valqa < valqb && valqe != "!") {newline = doMod(lineOne + valqe);}

break;

}

//

//

// P2 now

//

//

var zline = vna[lineTwo].toLowerCase();

// count the number of spaces in zline

var chratloopy = 0;

var numspaces = 0;

while (chratloopy < zline.length)

{

if (zline.charAt(chratloopy) == " ") numspaces++;

chratloopy++;

}

var newxline;

paramz = zline.split(" ");

valqa = doFunc(paramz[0]+"",lineTwo,2)*1;

if (numspaces > 0) var valqb = doFunc(paramz[1]+"",lineTwo,2)*1;

if (numspaces > 1) var valqc = doFunc(paramz[2]+"",lineTwo,2)*1;

if (numspaces > 2) var valqd = doFunc(paramz[3]+"",lineTwo,2);

if (numspaces > 3) var valqe = doFunc(paramz[4]+"",lineTwo,2);

if (valqd != "!") valqd *= 1;

if (valqe != "!") valqe *= 1;

switch (numspaces)

{

case 0:

if (zline == "x")

{

document.form1.dornd.disabled = true;

document.form1.doxrnd.disabled = true;

alert("Program 1 wins!");

return;

}

else

{

newxline = doMod(lineTwo + valqa);

}

break;

case 1:

firstchar = zline.charAt(0);

p2vararray[alphastring.indexOf(firstchar)] = valqb;

newxline = doMod(lineTwo + 1);

break;

case 2:

var replacestring = vna[doMod(lineTwo+valqa)];

// check for capital variables

var zzingl;

var dropfwhenzero = 1;

while (dropfwhenzero == 1)

{

zzingl = replacestring.length;

dropfwhenzero = 0;

for (eee=0;eee<zzingl;eee++)

{

if (capalphastring.indexOf(replacestring.charAt(eee)) != -1)

{

replacestring = replacestring.substring(0,eee) + p1vararray[capalphastring.indexOf(replacestring.charAt(eee))] + replacestring.substring(eee+1);

dropfwhenzero = 1;

}

}

}

vna[doMod(lineTwo+valqb)] = replacestring;

newxline = doMod(lineTwo + valqc);

break;

case 3:

var temptemptemp = vna[doMod(valqa + lineTwo)];

vna[doMod(valqa + lineTwo)] = vna[doMod(valqb + lineTwo)];

vna[doMod(valqb + lineTwo)] = temptemptemp;

if (vna[doMod(valqa + lineTwo)] == vna[doMod(valqb + lineTwo)])

{

newxline = doMod(lineTwo + valqc);

}

else

{

if (valqd != "!") newxline = doMod(lineTwo + valqd);

if (valqd == "!") newxline = doMod(lineTwo + valqc);

}

break;

case 4:

if (valqa == valqb) {newxline = doMod(lineTwo + valqc);}

if (valqa > valqb) {newxline = doMod(lineTwo + valqd);}

if (valqa < valqb && valqe == "!") {newxline = doMod(lineTwo + valqd);}

if (valqa < valqb && valqe != "!") {newxline = doMod(lineTwo + valqe);}

break;

}




// render the VNA

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

document.form1.point1.value = newline;

document.form1.point2.value = newxline;

}



function doMod(zeinput)

{

while (zeinput < 0)

{

zeinput += 200;

}

zeinput = zeinput % 200;

return zeinput;

}


function doFunc(param, qline, zpp)

{

if (param == "") return "";

if (param == "!") return "!";

if (alphastring.indexOf(param) != -1)

{

return doSuperFunc(param, zpp);

}

var tempeval;

var closeparen;

var funcin;

var beforeparstring;

var commaloc;

var parenloc;

var rightloc;

var funcname;

var inputarray = new Array();

/*var xdata = new Array();*/

// loop until param is just a number

while (param*1 != param)

{

closeparen = param.indexOf(")");

openparen = (param.substring(0,closeparen+1)).lastIndexOf("(");

funcin = param.substring(openparen+1,closeparen);

beforeparstring = param.substring(0,openparen);

commaloc = beforeparstring.lastIndexOf(",");

parenloc = beforeparstring.lastIndexOf("(");

rightloc = Math.max(commaloc,parenloc);

funcname = param.substring(rightloc+1,openparen);

funcname = funcname.toLowerCase();

//

/*alert(closeparen+" -- "+openparen+" -- "+commaloc+" -- "+parenloc+" -- "+rightloc+" -- "+zpp+qline); 

alert("Name: "+funcname+", Input: "+funcin);*/

//

inputarray = funcin.split(",");

for (yyyy=0;yyyy<inputarray.length;yyyy++)

{

inputarray[yyyy] = doSuperFunc(inputarray[yyyy],zpp);

}

switch (funcname)

{

case "sum":

case "add":

tempeval = 0;

for (tttt=0;tttt<inputarray.length;tttt++)

{

tempeval += inputarray[tttt];

}

break;

case "prd":

case "mul":

case "mult":

tempeval = 1;

for (ssss=0;ssss<inputarray.length;ssss++)

{

tempeval *= inputarray[ssss];

}

break;

case "inc":

case "incr":

tempeval = (inputarray[0] + 1);

break;

case "dec":

case "decr":

tempeval = (inputarray[0] - 1);

break;

case "neg":

tempeval = (inputarray[0] * -1);

break;

case "inv":

if (inputarray[0] == 0) {tempeval = 0} else {tempeval = 1 / inputarray[0];}

break;

case "num":

var linetoterm = vna[doMod(qline + inputarray[0])]+"";

tempeval = 1;

for (ccc=0;ccc<linetoterm.length;ccc++)

{

if (linetoterm.charAt(ccc) == " ") tempeval++;

}

if (linetoterm == "x") tempeval = 0;

break;

case "mod":

tempeval = (inputarray[0]*1) % (inputarray[1]*1);

break;

case "pow":

tempeval = Math.pow(inputarray[0],inputarray[1]);

break;

case "div":

tempeval = (inputarray[0]*1) / (inputarray[1]*1);

break;

case "sub":

tempeval = (inputarray[0]*1) - (inputarray[1]*1);

break;

case "log":

tempeval = Math.log(inputarray[1]*1) / Math.log(inputarray[0]*1);

break;

case "abs":

tempeval = Math.abs(inputarray[0]);

break;

case "int":

tempeval = Math.floor(inputarray[0]);

break;

case "ceil":

tempeval = Math.ceil(inputarray[0]);

break;

}

// replace part of param with tempeval... then loop again

param = param.substring(0,rightloc+1) + tempeval + param.substring(closeparen+1);

}

return param;

}


function doSuperFunc(qwerty, zppp)

{

var qwertest = alphastring.indexOf(qwerty);

if (qwertest != -1)

{

if (zppp == 1) qwerty = p1vararray[qwertest];

if (zppp == 2) qwerty = p2vararray[qwertest];

}

else qwerty *= 1;

return qwerty;

}


function doXRounds()

{

var getx = document.form1.xrd.value;

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

{

doRound();

}

}


function seeVars()

{

var ystr = "P1:\n";

for (inn=0;inn<26;inn++)

{

if (p1vararray[inn] != 0) ystr += alphastring.charAt(inn)+" = "+p1vararray[inn]+"\n";

}

ystr += "\nP2:\n";

for (inn=0;inn<26;inn++)

{

if (p2vararray[inn] != 0) ystr += alphastring.charAt(inn)+" = "+p2vararray[inn]+"\n";

}

alert(ystr);

}


/* end of script */

</script>

</head>


<body>

<h1>VNA.4 Emulator, by unreality</h1><form name="form1">

<br><br><br>P1 <br>

<textarea name="p1" rows=10 cols=100></textarea> <br>P2<br><textarea name="p2" rows=10 cols=100></textarea>

<br>

<center><input type="button" value="Switch" onClick="doSwitch();"><input type="button" value="Clear" onClick="doClear();"></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 42 to 158 please)

<br><br><br><br><center>Fill with: <input type="text" name="fillwith" length="10" value="x"></center><br><input type="button" value="Load the Virtual Node Array!" onClick="loadArray();"><br><hr><br>

VNA:<br><textarea name="vnarray" rows=30 cols=100></textarea><br>

P1 Pointer: <input type="text" name="point1" length="10"><br>

P2 Pointer: <input type="text" name="point2" length="10"><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"><input type="button" value="See Nonzero Variables" name="seevars" onClick="seeVars();" disabled="true">

</form>

</body>

</html>

Previous postings of the emulator are all defunct. This is the highest version... I wish there were some way to update the OP and post it. Maybe later if any more changes are done I will see if Rookie can edit the OP for me... hmm...

anyway, I added a function ceil(n) which is like int(n) except it does the ceiling instead of the floor. Just in case someone needs it at some point, I thought it'd be best to have both of them, since ceiling is NOT always the same thing as floor+1

Also, what I said earlier still applies... we could add a com(a,b,c,d,e) function, but we'd have to remove num(), since the two functions together would be catastrophic and a program could win on the first move.

do you want to duel Brutus Maximus vs Zebra Warrior and see if power conquers finesse or vice versa? If so, post here and I'll generate some starting values and run them against each other. Is this is the correct BM?

Brutus Maximus

a sum(a,1)

38 sum(41,a) 1

37 sum(44,a) 1

36 sum(47,a) 1

35 sum(50,a) 1

34 sum(53,a) 1

33 sum(56,a) 1

32 sum(59,a) 1

31 sum(62,a) 1

30 sum(65,a) 1

29 sum(68,a) 1

28 sum(71,a) 1

27 sum(74,a) 1

26 sum(77,a) 1

25 sum(80,a) 1

24 sum(83,a) 1

23 sum(86,a) 1

22 sum(89,a) 1

21 sum(92,a) 1

20 sum(95,a) 1

19 sum(98,a) 1

18 sum(101,a) 1

17 sum(104,a) 1

16 sum(107,a) 1

15 sum(110,a) 1

14 sum(113,a) 1

13 sum(116,a) 1

12 sum(119,a) 1

11 sum(122,a) 1

10 sum(125,a) 1

9 sum(128,a) 1

8 sum(131,a) 1

7 sum(134,a) 1

6 sum(137,a) 1

5 sum(140,a) 1

4 sum(143,a) 1

3 sum(146,a) 1

2 sum(149,a) 1

1 sum(152,a) -38

x

Share this post


Link to post
Share on other sites
  • 0

Yeah, I'll stick with that version; I wanted it to bomb all the way from 42 to 190 on the first round through and then increment. We'll see if it acts more like a legendary ancient warrior or more like a BM.

Share this post


Link to post
Share on other sites
  • 0

Zebra Warrior

add(mul(mod(z,2),3),int(div(z,2))) add(mul(mod(z,2),50),137,int(div(z,2))) 1

z mod(inc(z),5)

z 0 135 -2 -2

Brutus Maximus

a sum(a,1)

38 sum(41,a) 1

37 sum(44,a) 1

36 sum(47,a) 1

35 sum(50,a) 1

34 sum(53,a) 1

33 sum(56,a) 1

32 sum(59,a) 1

31 sum(62,a) 1

30 sum(65,a) 1

29 sum(68,a) 1

28 sum(71,a) 1

27 sum(74,a) 1

26 sum(77,a) 1

25 sum(80,a) 1

24 sum(83,a) 1

23 sum(86,a) 1

22 sum(89,a) 1

21 sum(92,a) 1

20 sum(95,a) 1

19 sum(98,a) 1

18 sum(101,a) 1

17 sum(104,a) 1

16 sum(107,a) 1

15 sum(110,a) 1

14 sum(113,a) 1

13 sum(116,a) 1

12 sum(119,a) 1

11 sum(122,a) 1

10 sum(125,a) 1

9 sum(128,a) 1

8 sum(131,a) 1

7 sum(134,a) 1

6 sum(137,a) 1

5 sum(140,a) 1

4 sum(143,a) 1

3 sum(146,a) 1

2 sum(149,a) 1

1 sum(152,a) -38

x

ZW vs BM

[Array filled with bombs (x)]

Generated Local Starting Values: 45, 57, 64, 75, 88, 96

Round 1 corresponds to line 45, R2 to 57, etc.

For every "a" round, ZW is P1 at 0; BM is P2 at [line number]

For every "b" round, BM is P1 at 0; ZW is P2 at [line number]

Round 1a: Infinite. BM got sucked into ZW's code and became another Zebra Warrior. Technically a tie.

Round 1b: BM wins after 3 rounds

Results: BM gets 1 point, the second point goes to no one as a tie

Round 2a: BM wins after 62 rounds

Round 2b: BM wins after 6 rounds, again by line attack placement... nice though!

Results: BM gets 2 points - sum of 3 pts

Round 3a: Infinite. BM got sucked into ZW's code and became another Zebra Warrior. Technically a tie.

Round 3b: BM wins after 32 rounds - close though! One round earlier and BM would've been sucked into the Zebra Warrior's snare

Results: BM gets another point for 4 pts

Round 4a: BM wins after 17 rounds

Round 4b: BM wins after 10 rounds

Results: BM now at 6 pts

Round 5a: ZW wins after 37 rounds! Hooray lol

Round 5b: Infinite. BM got sucked into ZW's code and became another Zebra Warrior. Technically a tie.

Results: BM at 6 points, ZW at 1 point [with 3 ties where BM got sucked into ZW]

Round 6a: ZW wins after 29 rounds, w00t

Round 6b: Infinite!

Final Results: BM has 6 wins, ZW has 2 wins and 4 suck-ins

Conclusions: the array-hopping skill of Zebra Warrior cannot match the brute force and firing power arsenal of the Brutus Maximus. Where the ZW alternates in copying itself and in firing off bombs, the Brute spends most of its time doing the latter, and this gives it the efficiency boost necessary to hunt down the enemy. You may call this a weakness for the system itself but I've found that VNA games are usually very rock-paper-scissors and a good conglomeration of course is where the creativity comes in. There is something that can beat Brutus, but it's not ZW of course. This future enemy must take into account the key weakness of BM, which is its vulnerability to being struck. It slightly overcomes this by having such an extended queue that it may have already killed the enemy before it runs into the bomb in its midst, but still a single bomb will cripple the BM, eventually. So maybe a bomber but once that's not so elongated as BM... a more compact killing machine of some kind.

But BM is definitely very strong... and it's not "nonclever". The placement of each individual bombing spot (by threes, in this case, however it's actually 3+n where n is the line distance from the zero line of the program, if you're counting from there to see where they hit relative to line zero) is what can be improved by more cleverness. The success of BM after 3 rounds on Round 1b may seem like luck but it was the many & precise placement of bombs after all that made this possible.

So to improve BM I would recommend the fix I recommended earlier, starting from 40 and increasing by 2 each line. This matches the current BM's "by-threes" system except it does it from the starting line, not from the relative line... so that would fix the BM's tendency to bomb very close together close from it, but farther apart as it gets farther from itself.

Regarding the "infinite" ones I realized that if they are sufficiently distanced from themselves they can bomb each other still since ZW bombs while hopping. But it specifically avoids bombing the next iteration by bombing 187 plus 0-2ish from the current line, which isn't anywhere near any local iterations. For a long time. Ergo, it will be endless pretty much 99. For fun I extended Round 5b out to 1000 Rounds (the do X rounds is working now btw) and they had filled almost the whole array with Zebra Warrior lines lol.

Just in case, I ran all of the "infinite" games out to one thousand rounds and none had ended b that time... it's Turing's "halting problem" of course but I think it's safe to say that they'll go on forever since we know the algorithm in the black box ;D

Do you think a program should get a point if the enemy gets sucked in to the trap even though technically neither wins? [uPDATE] I wrote most of the above 'Conclusions' section after round 4 when the outcome looked clear. I just finished Round 6 and BM only has 6/12 points; ZW has 2/12 points... with 4 "suck-ins". So it hinges on what those should be considered as. Ties? Wins? Divided points? If so that can change the pointage from 6-2 to 6-6 to 8-4

Share this post


Link to post
Share on other sites
  • 0

Never mind, i figured out my problem

z 46

z sum(5,z)

1 z -1 -1

Nice. What do you call it?

Is there a reason it uses SWITCH instead of COPY?

Also, quite ingeniously, your program can never hit itself if left to bomb indefinitely... nice! :D

Share this post


Link to post
Share on other sites
  • 0

Nice. What do you call it?

Is there a reason it uses SWITCH instead of COPY?

Also, quite ingeniously, your program can never hit itself if left to bomb indefinitely... nice! :D

I used the switch because its a new command to use, and the switch can jump to two different places.

I will probably use both jumps later.

It's name is currently attempt 1.

z 46

z sum(5,z)

1 z -1 -1

Share this post


Link to post
Share on other sites
  • 0

I think there'd be a relatively straightforward way to kill the BM pretty reliably: write a program that's a jumper/bomber like ZW but calibrate the distance it jumps so that if it takes n turns to go through a jumping/bombing cycle then it will advance by 4n nodes per jump. If it doesn't get killed by the first wave of BM bombing then at the end of the cycle it will be in the same relative position compared to the BM bombing position and can survive another cycle.

Of course, then I would just have to change the hard-coded BM bombing positions so that they're a random series instead of increments by 4.

Unfortunately my work schedule will keep me from having any brain cells to spare until the weekend... also why I'm holding off on introducing Phronism to Dawkins.net until I hit a lighter block.

Share this post


Link to post
Share on other sites
  • 0

yeah I was thinking a program like this:

"0"

the BM will only destroy itself if left to play for 10 iterations of its code or so... calculating exactly... the 39th line of BM bombs +38 from the zero line, aka 152+38 = 190, but a will be 1 at that time so 191. So when a is 10, that final bombing line will bomb 200 aka 0 from the zero line and ruin the program the next round.

a goes to 2 after the 40th round, 3 after the 79th round, etc, ie, +39 each time, 40 + 39(n-2) where n is the desired value of a, ie, 40 + 39n - 78 = "39n - 38" for the simplest equation. Thus a will turn 10 after 390-38 = 352 rounds. The bombing line that will cause the suicide is 38 rounds later. 352 + 38 = 390. Then it will jump back to that line and run the bombed line to kill itself: 390 + 1 = 391

So, if left to its own devices, a program such as "0" must survive 10 iterations of onslaught by the BM and 391 rounds total before the BM self-destructs.

Because of that, it may be that "hunkering down" to oppose the BM isn't the strategy. If it works, the 0 would have to be placed pretty cleverly or something, I'll try it in a bunch of places (I'll keep BM as P1 since the "0" doesn't really do anything anyway, and then just move P2 around) and see what happens...

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...