Jump to content
BrainDen.com - Brain Teasers

unreality

Members
  • Posts

    6378
  • Joined

  • Last visited

Everything posted by unreality

  1. unreality

    that's not what an RID is, but reaymond must mean a recruitable player - that's like Bb's Hybrid games
  2. unreality

    The 3X+1 problem is interesting because it still hasn't been proven to always converge to 1 (if you start with a positive integer I mean) edit: I'm sure wikipedia has an article on the subject aaand yes they do: http://en.wikipedia.org/wiki/3x%2B1
  3. unreality

    whoa, you've got it all wrong buddy Exactly - like I said, there's no easy solution, but it doesn't mean that we should stop trying - it's a given that megastructures are cheap. I just don't think they should be allowed, at all. That's all I did prod you, like I prodded everyone.... but the reason we were waiting was because two people didn't have their programs in yet. It was only afterwards that I discovered there was a problem with the a/b/c functions, which I apologized for. After I fixed it, I found that your program whupped mine ;D But I didn't do it on purpose as your next sentence implies: Now this is just unfounded! There was an accidental error in my program. This is my fault, yes, but I didn't do it on purpose. I wasn't like "Ohh Prime's looks intimidating, I'm going to pretend like his doesn't work on my emulator". Again, I'm sorry, but I didn't cause that error on purpose. I fixed it and it's okay now. I'm glad that your program beat mine, it made me realize an efficiency problem with the Awesome that I fixed in the Ghost (which your Fish2 then beat in the next round of matches). It's an ongoing cycle, and I don't mind when someone else wins, trust me It was just that error in my emulator. If you were also referencing FOTH's program, then there was an actual flaw in that - one number was wrong, and after FOTH changed it, it worked fine. If you're talking about megastructures, then yes. I'm not going to let megastructures become a part of VNA, however tempting they are. If you're talking about how the emulator didn't work on my computer, then I'm sorry, there's probably a problem in my Excel as its an older Mac version. It doesn't matter as there are so many emulators afloat. I seem to recall you saying that my emulator didn't work on your computer either lol Of course I want to compete. As of now, both you and FOTH have better VNA programming skills than me. I'm not an idiot, but you guys are just better I don't have to win to still want to compete. I do. And my emulator having a bug does NOT mean that I was intentionally trying to not compete against your programs If you want to know WHY I invited you, it's because I saw you were a programmer, and would probably be interested No, the more challenging the better ;D ....as long as I win [just kidding lol] I think there was some steam building up, and I think you're mad at me because my original emulator had that bug. Well let me assure you, I wasn't trying to shy away from fighting your programs. That's insane. After I fixed it, I ran battles and you won. End of story. What kind of person do you think I am? ~~ I think, overall, VNA 2.0 has been marred by a couple issues. As I am currently working on VNA 3.0, hopefully we can erase the past There are many changes in 3.0, and the problems of 2.0 (megastructures, backreferencing a/b/c parameters, etc) are all fixed. It's still in the developmental stages, but hopefully it'll be easier to understand and we'll get new blood. You don't have to play 3.0 if you want, and I'll understand if you don't, but I think it should be a better game [edit - typo]
  4. unreality

    Izzy I hate to pick holes in your argument since we are fighting for the same cause, but "Planck time" wasn't some period of time of the universe - it's a unit of time, like a second or minute or year, but a very small unit of time http://en.wikipedia.org/wiki/Planck_time
  5. unreality

    actually, Izzy, matter and energy are intrinsically the same thing... thanks to the famous equation E = mc2. Thank you Einstein Both energy and matter behave in odd ways... such that energy (such as light) can be characterized as "matter" (the dual behavior of light as both a wavelength and a photon particle) and matter can also be characterized as energy, made up of a wavelength, which can be calculated with some equations. If you hold two ends of a taut string and pluck it, the number of half-wavelengths at any time MUST be a whole number, thus explaining the occurence of whole numbers in Chemistry This does relate to the matter at hand because antimatter is thus, in a way, antienergy as well. In a balanced universe, Izzy is correct that everything totals to 0. Entropy changes, as bociniki said, but energy/matter are conserved. The total amount is always the same. I think that total amount is 0, due to antimatter, but I could be wrong. This is just my understanding, someone please correct me if I'm wrong ;D The tougher question... how the hell does this relate to evolution?
  6. yeah, the key with 3.0 is that there is no functions (which are the most confusing and also troublesome part of VNA 2), yet the way I'm setting it up is that it's still a very interesting game. We'll see, I'm developing it as we speak/type/whatever
  7. I have just started developing a new idea, something that could very well spin into VNA 3.0 if it seems good after some testing. This one is the most radical change from previous VNAs I think and would be much easier to pick up on for non-programmers
  8. unreality

    the point of this discussion, I thought, was to find a way to outlaw pesky megastructures without impeding on the functionability of legal programs. Clearly there is no strict computational way to measure megastructure, it's more of a case-by-case human judgment thing. Just because there are no exact rules forbidding megastructure, it IS a cheap shot and NOT legal (maybe not yet, but it should be), at least by my standards... it doesn't mean we should just say "oh well" and jump on the megastructure train. I'm trying to think of a way to prevent megastructures otherwise, but it's a fuzzy line between necessary function nesting and uber-repetitive-&-sequential function nesting. So I hope you don't actually put one in your program.... by the way this tournament seems to be going, I don't think I'll participate. Sorry man, I think it's fun, but megastructures (and some other things that crossed my mind) are a huge snag I think it may just be you and Mekal for this one ;D (unless someone has been secretly working on a program that will pwn us all )
  9. unreality

    not to sound like a jerk but I've already invented this one It's in the Mafia Discussion topic somewhere. Also, Incognito (PM me if you don't know what it is) is having a game soon called 'Mafiaholics', which is similar to that concept as well [but uses real names from classic BD players, slightly altered] to reaymond: yeah I'm kinda caught up in the moment and I don't think I'll be able to play any game at all... sorry
  10. unreality

    probably And thanks for retracting the no-bomb rule, my program needs that. Max nesting level of say 50? Also, I'm adding the following function to my emulator: nzero(n,a,b) = if all three parameters on line n are zero, returns a. Otherwise, returns b if just 'n' is given, I'll assume they mean nzero(n,0,1) and fill it in for them, but given the second two input values, it removes the almost-necessity of using an equ with the nzero to match the 0 or 1 to another value.
  11. unreality

    You know I hate "characterizing" mafia roles or vice versa, just trying to reproduce popular fiction franchises. I tried it once in LOST Mafia, and it failed lol, and I see it fail in Brainden. You could argue that Jumper was like that but I didn't use any actual characters from Jumper, rather the basic concept of teleportation. My advice: try to think of something original. If you have to ask for advice on a thread, maybe you should rethink The game should be your own construction IMO
  12. unreality

    about the problem of a line with length x, and finding the average distance between two random points on the line, couldn't you do it
  13. unreality

    it seems like you've discovered the Megastructure then: equ(a(40),0,equ(a(41),0,equ(a(42),0,equ(a(43),0,equ(a(44),0,equ(a(45),0,equ(a(46),0,equ(a(47),0,equ(a(48),0,equ(a(49),0,equ(a(50),0,equ(a(51),0,equ(a(52),0,equ(a(53),0,equ(a(54),0,equ(a(55),0,equ(a(56),0,equ(a(57),0,equ(a(58),0,equ(a(59),0,equ(a(60),0,equ(a(61),0,equ(a(62),0,equ(a(63),0,equ(a(64),0,equ(a(65),0,equ(a(66),0,equ(a(67),0,equ(a(68),0,equ(a(69),0,equ(a(70),0,equ(a(71),0,equ(a(72),0,equ(a(73),0,equ(a(74),0,equ(a(75),0,equ(a(76),0,equ(a(77),0,equ(a(78),0,equ(a(79),0,equ(a(80),0,equ(a(81),0,equ(a(82),0,equ(a(83),0,equ(a(84),0,equ(a(85),0,equ(a(86),0,equ(a(87),0,equ(a(88),0,equ(a(89),0,equ(a(90),0,equ(a(91),0,equ(a(92),0,equ(a(93),0,equ(a(94),0,equ(a(95),0,equ(a(96),0,equ(a(97),0,equ(a(98),0,equ(a(99),0,equ(a(100),0,equ(a(101),0,equ(a(102),0,equ(a(103),0,equ(a(104),0,equ(a(105),0,equ(a(106),0,equ(a(107),0,equ(a(108),0,equ(a(109),0,equ(a(110),0,equ(a(111),0,equ(a(112),0,equ(a(113),0,equ(a(114),0,equ(a(115),0,equ(a(116),0,equ(a(117),0,equ(a(118),0,equ(a(119),0,equ(a(120),0,equ(a(121),0,equ(a(122),0,equ(a(123),0,equ(a(124),0,equ(a(125),0,equ(a(126),0,equ(a(127),0,equ(a(128),0,equ(a(129),0,equ(a(130),0,equ(a(131),0,equ(a(132),0,equ(a(133),0,equ(a(134),0,equ(a(135),0,equ(a(136),0,equ(a(137),0,equ(a(138),0,equ(a(139),0,equ(a(140),0,equ(a(141),0,equ(a(142),0,equ(a(143),0,equ(a(144),0,equ(a(145),0,equ(a(146),0,equ(a(147),0,equ(a(148),0,equ(a(149),0,equ(a(150),0,equ(a(151),0,equ(a(152),0,equ(a(153),0,equ(a(154),0,equ(a(155),0,equ(a(156),0,equ(a(157),0,equ(a(158),0,equ(a(159),0,equ(a(160),0,80,156),155),154),153),152),151),150),149),148),147),146),145),144),143),142),141),140),139),138),137),136),135),134),133),132),131),130),129),128),127),126),125),124),123),122),121),120),119),118),117),116),115),114),113),112),111),110),109),108),107),106),105),104),103),102),101),100),99),98),97),96),95),94),93),92),91),90),89),88),87),86),85),84),83),82),81),80),79),78),77),76),75),74),73),72),71),70),69),68),67),66),65),64),63),62),61),60),59),58),57),56),55),54),53),52),51),50),49),48),47),46),45),44),43),42),41),40),39),38),37),36) fortunately, nobody will ever use this, so we're okay This just checks a-params, it would be at least three times as long if it checks b and c params too. Although the task is exponentially easier with nzero(), it still fits into the megastructure category, which I unofficially outlawed in the VNA 2.0 topic after posting an example of a megastructure. No offense, but I'm not going to join this tournament if you're going to be adding new rules and stuff. The rule is unnecessary. If someone was really going to use a megastructure or similar thing (which actually isn't as effective against something like a Hopper or really anything that nests the actual program with a big prefix or suffix of bombs with non-zero parameters to throw off Hunters), anyway, the second round would almost be just as effective. Also, my program does bomb on the first round, it's essential to its structure. But the bomb is made specifically to cover up its jump command that sends it to the actual program so that any program following behind won't land on it. So, let every program bomb on the first round. Many programs need that, others don't. A better way is just to screen for megastructures, and if someone submits one then chuckle - because they're not as effective as you might think. The chance of infinite regress is higher, as you said, but Hunters in general are ineffective because the better programs now shroud themselves in a shell of nonzero-parameter bombs anyway.
  14. unreality

    how about: +5 if your enemy hits a bomb (other program gets +0) +3 if you override the other program (other gets +0) +1 if the game is still going after 2000 rounds (both get +1) * rematch or cancel game if someone overloads the pointer count then we could total up each program's points and divide by the number of rounds that program played - so if one round ended in a pointer overflow, it doesn't factor into the average
  15. unreality

    Cool Do you mind if I overindulge on function nesting in my Quicksand then? My goal is to make it as small and concise as possible, but there will be at least three nested equs, maybe more. Just let me know if there's a flood limit or if something will slow it down.
  16. I agree with itachi and octo - in fact oddly I was going to make this topic myself. I can't stand it when people say 'happy holidays' consciously in replacement of 'merry christmas'
  17. We've gotten so many I'm beginning to lose track Kat and her brother Limeliam Pw0nzd and his brother RainThinker Skywalker and his brother Foxtacy And I swear there's another one, but I can't remember... this is where we can get it all straight ;D
  18. unreality

    haha octopuppy, that's hilarious as for the lawyer part - hehe our very own Brandonb is a lawyer ;D Better not get too vile here
  19. unreality

    it says: Microsoft Excel 2004 for Mac Version 11.0 it could be that something is not working cross-platform, knowing MS. I have no macro security at all, so w/e. I'll just use one of my two emulators lol Anyway - about nzero() - I guess I'll add it to mine, though did you also add rand()? I had that one there too, but removed it later [just like nzero()]. If you have, rand() at least needs to be removed without a doubt And what exactly would the and/or functions do? Would they be bitwise operators? Because you can just use the com() function or its siblings (equ,geq,leq) for bitwise operations too, as well as base10 and/or functions
  20. unreality

    lol I invented VNA, and I know what's there Like I said, I put nzero in the function codebox but then later, in the OP (if you read the whole thing, it's near the bottom of the OP) I explained that it wasn't an actual function but rather a general case, and I gave the replacement function that did the same thing but was much more flexible in the AZ/NZ values returned It's really kind of insulting to say "please, read VNA 2.0 specifications"... when I invented them... edit: I don't have a problem with putting nzero in, I think that's awesome (after all I did put in the function box, just as a pseudo-function), but it's just the way you said it. nvm. Also, have you posted the Fish2.2 code anywhere? I downloaded your excel emulator but when I opened it, it freaked out, opened all of the code and said there was a bunch of debugging errors. Then it wouldn't let me quit, it kept popping up saying there was an error somewhere, so I had to force quit. Did that happen for anyone else?
  21. strange - works perfectly for me. I'll give the raw code in case there was an upload problem. Just copy this, paste it into a text file, then save the text file as vna2.html or something similar <html> <head> <title>VNA 2.0 Emulator, by unreality</title> <script LANGUAGE="JavaScript"> /* global declarations */ var vna = new Array(); /* 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; for (i=0;i<200;i++) { iString = "BLANK 0;0;0"; if (i<pr1.length) {iString = pr1[i];} if (i>=nStart && i<nStart+pr2.length) {iString = pr2[i - nStart];} if (iString == undefined) iString = "BLANK 0;0;0"; 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; } function doRound() { // increment round counter document.form1.rnds.value++; // pointer locations var lineOne = document.form1.point1.value; var lineTwo = document.form1.point2.value; // P1 first var zline = vna[lineOne]; // chop it up var paramstart = 0; var cmdname = zline.substring(0,5); if (zline.charAt(4) == " ") { cmdname = zline.substring(0,4); paramstart = 5; } else { paramstart = 6; } var paramstring = zline.substring(paramstart); var paramz = new Array(); paramz = paramstring.split(";"); // reduce to numbers var vala = doFunc(paramz[0], lineOne*1)*1; var valb = doFunc(paramz[1], lineOne*1)*1; var valc = doFunc(paramz[2], lineOne*1)*1; // switch based on command cmdname = cmdname.toUpperCase(); var newline; zline = lineOne*1; switch (cmdname) { case "JUMP": newline = doMod(zline+vala); break; case "BOMB": document.form1.dornd.disabled = true; document.form1.doxrnd.disabled = true; alert("Program 2 wins!"); return; break; case "COPY": vna[doMod(zline+valb)] = vna[doMod(zline+vala)]; newline = doMod(zline+1); break; case "SHIFT": vna[doMod(zline+valb)] = vna[doMod(zline+vala)]; newline = doMod(zline+valc); break; case "BLANK": newline = doMod(zline+1); break; case "SWAP": var linew1 = vna[doMod(zline+vala)]; var linew2 = vna[doMod(zline+valb)]; vna[doMod(zline+vala)] = linew2; vna[doMod(zline+valb)] = linew1; newline = doMod(zline+1); break; case "EDITA": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); vna[doMod(zline+vala)] = linew3.substring(0,charspace+1) + valb + ";" + linewsplit[1] + ";" + linewsplit[2]; newline = doMod(zline+1); break; case "EDITB": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); vna[doMod(zline+vala)] = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + valb + ";" + linewsplit[2]; newline = doMod(zline+1); break; case "EDITC": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); vna[doMod(zline+vala)] = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + linewsplit[1] + ";" + valb; newline = doMod(zline+1); break; case "EDITX": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); var whichtoput; if (valc == 0) whichtoput = linew3.substring(0,charspace+1) + valb + ";" + linewsplit[1] + ";" + linewsplit[2]; if (valc == 1) whichtoput = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + valb + ";" + linewsplit[2]; if (valc == 2) whichtoput = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + linewsplit[1] + ";" + valb; vna[doMod(zline+vala)] = whichtoput; newline = doMod(zline+1); break; case "EDITI": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); var whichtoput; valb += linewsplit[valc]; if (valc == 0) whichtoput = linew3.substring(0,charspace+1) + valb + ";" + linewsplit[1] + ";" + linewsplit[2]; if (valc == 1) whichtoput = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + valb + ";" + linewsplit[2]; if (valc == 2) whichtoput = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + linewsplit[1] + ";" + valb; vna[doMod(zline+vala)] = whichtoput; newline = doMod(zline+1); break; case "PCOPY": var cursubj = vna[doMod(zline+vala)]; var curdest = vna[doMod(zline+valb)]; curdest = curdest.substring(curdest.indexOf(" ")); cursubj = cursubj.substring(0,cursubj.indexOf(" ")); vna[doMod(zline+valb)] = cursubj + curdest; newline = doMod(zline+1); break; } // // // P2 now // // var zline = vna[lineTwo]; // chop it up var paramstart = 0; var cmdname = zline.substring(0,5); if (zline.charAt(4) == " ") { cmdname = zline.substring(0,4); paramstart = 5; } else { paramstart = 6; } var paramstring = zline.substring(paramstart); var paramzz = new Array(); paramzz = paramstring.split(";"); // reduce to numbers var vala = doFunc(paramzz[0], lineTwo*1)*1; var valb = doFunc(paramzz[1], lineTwo*1)*1; var valc = doFunc(paramzz[2], lineTwo*1)*1; // switch based on command cmdname = cmdname.toUpperCase(); var newline; zline = lineTwo*1; switch (cmdname) { case "JUMP": newxline = doMod(zline+vala); break; case "BOMB": document.form1.dornd.disabled = true; document.form1.doxrnd.disabled = true; alert("Program 1 wins!"); return; break; case "COPY": vna[doMod(zline+valb)] = vna[doMod(zline+vala)]; newxline = doMod(zline+1); break; case "SHIFT": vna[doMod(zline+valb)] = vna[doMod(zline+vala)]; newxline = doMod(zline+valc); break; case "BLANK": newxline = doMod(zline+1); break; case "SWAP": var linew1 = vna[doMod(zline+vala)]; var linew2 = vna[doMod(zline+valb)]; vna[doMod(zline+vala)] = linew2; vna[doMod(zline+valb)] = linew1; newxline = doMod(zline+1); break; case "EDITA": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); vna[doMod(zline+vala)] = linew3.substring(0,charspace+1) + valb + ";" + linewsplit[1] + ";" + linewsplit[2]; newxline = doMod(zline+1); break; case "EDITB": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); vna[doMod(zline+vala)] = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + valb + ";" + linewsplit[2]; newxline = doMod(zline+1); break; case "EDITC": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); vna[doMod(zline+vala)] = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + linewsplit[1] + ";" + valb; newxline = doMod(zline+1); break; case "EDITX": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); var whichtoput; if (valc == 0) whichtoput = linew3.substring(0,charspace+1) + valb + ";" + linewsplit[1] + ";" + linewsplit[2]; if (valc == 1) whichtoput = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + valb + ";" + linewsplit[2]; if (valc == 2) whichtoput = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + linewsplit[1] + ";" + valb; vna[doMod(zline+vala)] = whichtoput; newxline = doMod(zline+1); break; case "EDITI": var linew3 = vna[doMod(zline+vala)]; var charspace = linew3.indexOf(" "); var linew4 = linew3.substring(charspace+1); var linewsplit = new Array(); linewsplit = linew4.split(";"); var whichtoput; valb += linewsplit[valc]; if (valc == 0) whichtoput = linew3.substring(0,charspace+1) + valb + ";" + linewsplit[1] + ";" + linewsplit[2]; if (valc == 1) whichtoput = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + valb + ";" + linewsplit[2]; if (valc == 2) whichtoput = linew3.substring(0,charspace+1) + linewsplit[0] + ";" + linewsplit[1] + ";" + valb; vna[doMod(zline+vala)] = whichtoput; newxline = doMod(zline+1); break; case "PCOPY": var cursubj = vna[doMod(zline+vala)]; var curdest = vna[doMod(zline+valb)]; curdest = curdest.substring(curdest.indexOf(" ")); cursubj = cursubj.substring(0,cursubj.indexOf(" ")); vna[doMod(zline+valb)] = cursubj + curdest; newxline = doMod(zline+1); 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) { 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("Name: "+funcname+", Input: "+funcin); // inputarray = funcin.split(","); switch (funcname) { case "add": tempeval = (inputarray[0]*1) + (inputarray[1]*1); break; case "sub": tempeval = (inputarray[0]*1) - (inputarray[1]*1); break; case "mul": tempeval = (inputarray[0]*1) * (inputarray[1]*1); break; case "div": tempeval = (inputarray[0]*1) / (inputarray[1]*1); break; case "mod": tempeval = (inputarray[0]*1) % (inputarray[1]*1); break; case "pow": 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(funcin*1); break; case "int": tempeval = Math.floor(funcin*1); break; case "com": if (inputarray[0]*1 == inputarray[1]*1) { tempeval = inputarray[2]*1; } else if (inputarray[0]*1 > inputarray[1]*1) { tempeval = inputarray[3]*1; } else { tempeval = inputarray[4]*1 } break; case "equ": if (inputarray[0]*1 == inputarray[1]*1) { tempeval = inputarray[2]*1; } else { tempeval = inputarray[3]*1 } break; case "geq": if (inputarray[0]*1 >= inputarray[1]*1) { tempeval = inputarray[2]*1; } else { tempeval = inputarray[3]*1 } break; case "leq": if (inputarray[0]*1 <= inputarray[1]*1) { tempeval = inputarray[2]*1; } else { tempeval = inputarray[3]*1 } break; case "a": var xline = doMod(qline + funcin*1); var xxline = vna[xline]; xxline = xxline.substring(5); if (xxline.charAt(0) == " ") xxline = xxline.substring(1); xdata = xxline.split(";"); tempeval = doFunc(xdata[0], xline); break; case "b": var xline = doMod(qline + funcin*1); var xxline = vna[xline]; xxline = xxline.substring(5); if (xxline.charAt(0) == " ") xxline = xxline.substring(1); xdata = xxline.split(";"); tempeval = doFunc(xdata[1], xline); break; case "c": var xline = doMod(qline + funcin*1); var xxline = vna[xline]; xxline = xxline.substring(5); if (xxline.charAt(0) == " ") xxline = xxline.substring(1); xdata = xxline.split(";"); tempeval = doFunc(xdata[2], xline); break; } // replace part of param with tempeval... then loop again param = param.substring(0,rightloc+1) + tempeval + param.substring(closeparen+1); } return param; } function doXRounds() { var getx = document.form1.xrd.value; for (i=0;i<getx;i++) { doRound(); } } /* end of script */ </script> </head> <body> <h1>VNA 2.0 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><input type="button" value="Load the Virtual Node Array!" onClick="loadArray();"><br><hr><br> VNA:<br><textarea name="vnarray" rows=40 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"> </form> </body> </html> If it still doesn't work, it means that your Web Browser can't handle one of the newer array methods, probably .split() - I actually have a pretty older browser, like one version back from the newest Firefox, and it works very smoothly. So I don't know what to tell you
  22. unreality

    nzero is not an actual function, I was just using it to explain some things, later in the OP I gave what you could use with existing functions to calculate nzero and make it more flexible as for the emulator - maybe it didn't upload properly, cuz it works great for me. I'll post the raw code in the VNA 2.0 topic
  23. unreality

    finished my JavaScript emulator Works awesome, very fast, and able to handle the kind of crazy backloops that the excel emulators were having trouble with. Although it has some error detection in the beginning, it doesn't detect if you're using the correct syntax (other than auto-capitalizing commands and de-capitalizing functions), so I don't know what will happen if you plug in bad syntax, let's not find out anyway, here it is ;D Enjoy! Just drag it onto your web browser and voila! http://brainden.com/forum/index.php?s=&amp...st&p=109350 I may make future updates to it, if a feature is requested
×
×
  • Create New...