Jump to content
BrainDen.com - Brain Teasers

unreality

Members
  • Posts

    6378
  • Joined

  • Last visited

Everything posted by unreality

  1. Prof T: yeah I think that's a way you can use to estimate pi. I saw a java applet that let you do it, it took a lot of drops to get close to pi though lol ~~ more generally: what is the probability?
  2. haha thanks ;D You too. See you on incog

  3. yes better wording would be "snake body parts can only touch (orthogonally or diagonally) the body part 1 or 2 segments in front or behind them, not any body parts farther along on the snake"
  4. You have an infinite plane filled with infinite parallel lines, all parallel to the same line, each line a unit distance apart... kind of like a giant sheet of paper with straight lines drawn across at regular intervals. You drop a needle of unit length (ie, the same length as the distance between the parallel lines) onto the infinite plane. What is the probability that it will cross one of the lines? Specifications: * by "crossing a line", I mean having points along the needle that fall on either side of the line. So a needle that rests exactly along a line is NOT considered to cross the line. Neither is a needle that is perfectly vertical with its bottom point on one line and its top point on another (but all other vertical needles WILL cross one of the lines obviously) * all points and lines are geometric, ie, infinitely thin This problem can be solved with calculus for sure - but I'm asking a secondary question: can the problem be solved WITHOUT calculus? Good luck
  5. So the "Random Killer" MIA players have no control over who they kill at night?
  6. I thought I spelled it out clearly... multiple times You win when your enemy's program dies [ie, all of its pointers are in stasis]. This happens when its energy hits 0. There are various techniques you can do (such as "JUMP 0,0" or "JUMP 0,100" and longer traps) that can be used to attack the enemy. There are no more simple, mindless BOMBs - you have to be more creative. I showed some "traps" in the spoiler entitled 'Tips and Tricks and Bombs' which is the one right before the emulator spoiler. Your program is composed of pointers. At first you only start out with pointer #1, which begins at the first line of your program when it's placed in the VNA. However, a pointer can create a new pointer with JUMP as well as jump around existing pointers. See the description of that command for more detailed info You can have up to 9 pointers. Also, download the emulator and run different programs on it, it will help you see how it works. You could use some of the programs I've posted so far, like Redhopper or Scythe, and pit them against each other, etc. Did you see the section entitled "Numerical Specifications"? Copied here: 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" ~~~ Also, in case you didn't click the 'Help' button in the emulator [i'm pretty sure it's on there], in the pointer data given, it either says "stasis" if the pointer is in stasis, OR it gives two numbers separated by a semicolon like this: 137;10 this means the pointer is at line 137 [the first line of the VNA is line 0] and has 10 energy The first number is line number, the second is energy
  7. Zarball Spectators The answer, perhaps counterintuitively, can be approximated by
  8. 218 views, 12 downloads, let's get some more discussion Who wants to battle? Maybe we could start a tournament...
  9. hahaha These are hilarious, itachi
  10. unreality

    If you remember, you know If you don't remember, you know [or "knew" at one time, since you "don't remember" as opposed to never having learned it in the first place] So what you remember at this moment in time is a subset within what you know and have stored away in your brain. Have you ever, after some time of doing something else, said "hey guess what - cats exist." A second before, you had no idea that cats exist. And then "Brazil exists." A second ago, you didn't remember that Brazil existed. But you still knew
  11. no signup necessary More of an informal slew of matches against each other. Or, if you want, we can have a King of the Hill (KOTH) tournament that's not a fixed-time tournament but rather everyone just submits a bunch of programs and I randomly and continuously run some against each other to determine which programs are on "the hill". Or we could have a structured tournament. Or just matches. Whatever you want
  12. unreality

    * do more situps. All this mafia is keeping me down, I'm supposed to have like a model sixpack by the time track season starts lol * spend less time on BD/online in general ;D hehe. I've already dropped way down in my BD useage, hopefully so on Incog after CM ends. I might feel the urge to go on Lostpedia occasionally when LOST starts though * one other thing, but it's not a year-round thing, more of a one-week type thing I have to do leading into another thing I have to do and it has nothing to do with resolutions or years so nvm
  13. unreality

    yeah I especially like pw0nzd's poem
  14. 80 views, 6 emulator downloads, and no comments yet?? I'm ready to battle! ;D hehe I've just made a program that could be described as a 'quick-bomber'. It uses a clever mechanism to spawn all 9 pointers in a single round, and then keeps them in a bombing loop. While much smaller than Hydra, it's probably more vulernable as Hydra is self-repairing [thus the name] and compartamentalized while this program (Scythe) has all its pointers running the same loop and is thus susceptible to a single bomb. Anyway, here it is ;D It has a built-in feature to skip bombing itself. It uses Fling Traps for the bombs Scythe SET! 48,0 FOOD 0,0 JUMP m=q+1,0 FOOD 0,0 SET! c_!_235_48_48_m=!+2,0 COPY 2,m=!+q JUMP 0,-3 JUMP 0,100
  15. unreality

    Jumper Mafia

    Just posting cuz I was rereading some of the game. I think this might have been the best game I've hosted, everything seemed to work out awesomely [lol the Intro was a bit long, I've tried to shorten all of my posts in Classic Mafia]
  16. This is the self-sustaining hopper I wrote. While still easily beaten by one of my Hydras, it's pretty nifty anyway. Redhopper COPY !,m=!+117 SET! c_!_3_0_0_m=!+1,0 FOOD 0,0 JUMP 0,c_!_0_114_-3_-3 It uses 117 as its hop-constant [the distance it jumps away each 'iteration'. An iteration for Redhopper is 16 rounds], which allows for 40 iterations or 640 rounds before overwritten the tip of itself. If you used 87 as a constant, it would allow about 1120 rounds before overwrite. I think the ideal constant for Redhopper is 152 or 148, but I haven't calculated it out yet. It could be something else. Anyway that doesn't even matter Enjoy!
  17. For a Michigander like myself, I'm not even embarassed This is hilariously awesome. All I can say is... better luck next year! lmao ;D
  18. unreality

    ah nice Yes having random parameters... wow, that's an excellent idea ;D
  19. 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 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 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 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 If you did peek, and now you're confused, don't worry, I know that some of this is complicated ~~~ 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 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 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
  20. unreality

    sorry I haven't been working on these- been really busy Let's see... Here's a question: can you construct a Turing machine from VNA?
  21. unreality

    I calculated a possible base to ≈ 4.1816298, so lol I don't think that's it
  22. Over the last week and a half I've been working pretty hard on VNA 3.0, shaping it, testing it, etc, and also making the JavaScript emulator, which is fully functional and has some side-functions. So... pretty soon, I think I'll start a VNA 3.0 topic
  23. oops I was looking at profile views not posts....................ummm disregard the previous comment. lol. Merry xmas ;D

×
×
  • Create New...