Jump to content
BrainDen.com - Brain Teasers

Prime

Members
  • Posts

    871
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by Prime

  1. Prime

    My emulator has nzero(n) function, which returns 0 if all 3 arguments at n are zero, and 1 otherwise. It was done per original specifications. Since I have annonced it that way and distributed with my Emulator, I am going to leave it in that form for the tournament. After the tournament, I can change it to nzero(n,a,b). I implemented slightly different more efficient "megastructure" argument. It searches for starting location of the opponent and bombs it. For 2n locations it nests only n levels. Theoretically, you could search 120 locations with it. I made it to check only 40 locations, or so. And it kills on the first move quite often. Such first command does not hamper the rest of the program in any way. It is a SHIFT command, which jumps into the main logic of the program afterwards. It's a cheap shot, but it gives a huge advantage. And if it is legal, why not? I will leave nesting level at 100, since that's the way it in the Emulator that I posted for everyone to download.
  2. Prime

    "Megastructure" which checks all 120 nodes for the opponent's starting location is almost guaranteed to win when it has the first move. Regardless, of filler bombs with non-zero arguments, every pointer starts at its first location. To avoid the hit, the oponnent program would have to start with a command with all 3 arguments 0. (Like BLANK 0;0;0, and hit the bomb as soon as it reaches the node where its first meaningful command used to be.) The imposed nesting limit does not allow checking all 120 locations. But testing a number of locations and bombing the first non-zero one could give a serious advantage on the first move. Also, I must remind, there is nzero(n) function, which checks all 3 arguments at the node n. Feel free to use it. (And it would be more convenient to use in a megastructure like the one in the above post.) So, we can allow bombing on the first move. The other rules, I stand by: 1). Maximum nesting level -- 100. Or should we make it smaller? 2). Any program exceeds nesting level -- both programs lose that match. 3). A program must pass qualifying test to enter the tournament. It should be able to run unopposed for some number of rounds. I think 200(?). I take it upon myself to be able to run a contest in my emulator between all qualifying entries. Normally, it takes less than a minute for each match. So, qualifying round on Dec. 25? Anyone is going to be ready by then?
  3. Prime

    But the average length of a triangle side is not the same thing as average distance between 2 points inside a circle. Being a side of triangle makes additional constraints on the segment length. The solution path was: once the average segment length is found, find the distance to that segment from another random point, and not the other two sides of the triangle. So what would your simulator yield for the average distance between 2 points inside a unit circle? I think PVPA's solution to that may be correct. Of course, in view of your correction on where the forth point may be, finding the average triangle area is not a solution to the OP, as we thought. The solution seems even more complex now. But here is one observation: if we take any triangle on an infinite surface (not bounded by a circle), then the probability for the 4th pont to fall in the area where it would make a convex quadrangle is 1/2. (The sectors projected outside the triangle add up to 180o.) So for a very small triangle in the center of the circle, the probability tends to 1/2.
  4. Prime

    My reasoning for the scoring system is as following: Leaving the infinite loop (nesting level exceeded) situation aside, I made it a zero-sum scoring system. That is total number of points for each game is 4. Whatever points one contestant is loosing, the other is gaining, and their total for the game always adds up to 4. Giving 5:0 and 3:0 score for bombing and overriding respectively implies that bombing is a "better" win, but being bombed and being overriden is the same kind of loss. It could make sense, so we should think about it some more. However, bombing should be a priority win criteria. E.g., if your program after overriding the opponent ended up in a situation with two uncooperative copies of self and the pointer of the "overrider" hit a bomb -- that should be a loss by bombing, not a win by overriding. Overriding should only be counted when the two copies ended up in an infinite harmless cycle. Which is a kind of draw. Yet, here is my reason for making it a win: I observed how a hopper program landed inside Fish3's body, whereupon Fish3 detected and repaired the node, which resulted in both pointers running inside Fish3's body and bombing the outside field forever. Now about the nesting level violation. We have a good reason here for penalizing both programs. On one hand the program, which has lots of conditions, which include testing arguments at other nodes gets an advantage. Disregarding situations where such testing leads to an infinite regression, or excessive testing makes it easier to code. One could develop a program with too much recursive testing, which is more likely to bomb the opponent in the initial stages, or go into an infinite regress. Discarding and allowing to replay such a match, helps the offender to make a number of tries until the two programs are positioned in such a way that it wins. On the other hand, it is simple enough to write arguments that would cause your opponent go into an infinite regress, should they happen to test them. Also, I'm sticking with my previous idea of picking a random location, running the match, then swapping the programs and run another match using the same location. (That eliminates some element of luck.) Discarding matches if a program goes into an infinite loop would interfere with such swapping system. So, I think, both programs should be penalized, if one violates nesting level. NO REPLAYS! Also, I am introducing another rule here. NO BOMBING ON THE FIRST INSTRUCTION! We don't want to give an easy win to the program, which finds first non-zero node within some 50 nodes outside itself and throws a bomb there.
  5. Prime

    I set nesting limit to 100, arbitrarily. So, at any point point inside your argument if you count more than 100 opened left parenthesis (yet unmatched with the right parenthesis) -- that argument would fail. For example, equ(a(add(c(20),1)),2,0,1) has nesting level 4 at the point highlighted in red. However, there is no guaranty that that statement would not exceed maximum nesting level of 100. The reason being, there are further references like a() and c(), which can, in turn, nest deeper, and then make some further refernces to other arguments. I am thinking to make a quilifying test for the tournament entry. A program must be able to run unopposed for a certain number of rounds, say 100, without bombing itself, or bumming out on nesting limit. Currently, my Fish4 has a problem with the latter requirement. Starting in the empty field, it runs 68 rounds and then exceeds the nesting limit as it keeps finding own copies left behind. I am working on improvement. Currently, Fish4's main decision-making argument features 7 equ()-s, 6 argrument references, 4 nzero()-s, and 3 add()-s. And the deepest level of nesting at any point there is 7. Also, I am thinking of adopting the following scoring system: 1). 4:0 when opponent's pointer hit the bomb. 2). 3:1 when a program runs over the opponent leaving 2 copies of itself running with neither hitting a bomb. 3). 2:2 when two programs ran for a specified number of rounds, e.g., 1000, without any of the above conditions happening. 4). 0:0 when one of the pointers exceeded allowed nesting level. I am not sure, whether the last condition is fair. It is designed to penalize both contestants, when one exceeds maximum nesting level. Let me know what you think of the rules. I could run a tournament on Dec 28, if we get qualifying contestants by Dec 27.
  6. Prime

    It well may be that MS Excel with macros does not work on Mac. Pitty. I've prepared a non-functional data only copy of my Emulator. So that if Excel macros don't work on your computer, you can at least see what it looks like. It also includes sample programs and VNA reference. But it has no macros (programming code), allowing to validate and run VNA programs. Also, I made some updates to the Emulator. I changed it to highlight and select the command which is going to be executed next, instead of the command that just has executed. That seems to make more sense, somehow. Also, few other cosmetic changes here and there. Please download the updated version of the VNA. nzero(n) function performs as coded. It equals zero when all 3 arguments at line "n" are zero, and 1 otherwise. It is a very powerful tool. Using it, I wrote Fish4 (Shark), which feeds primarily on Fish2 and Ghost. And I managed to keep the arguments in the SHIFT command down to a manageable size. I have changed my mind about implementing and() and or() functions. They would make coding conditions too easy. I think the competition is more interesting using less convenient equ() and com() functions. Programs' ability to check all locations at once on the VNA battlefield must be limited. My Fish4 (Shark) is almost ready. I'd like other contestants to post here whether they are close to developing their VNA combatants. I can run a tournament on my emulator, since it's been working well for 100s and even 1000s of rounds at a time, while evaluating long multi-story arguments refering to each other.
  7. Prime

    Now nzero(n) is a function. Everything included in your original specifications in VNA2.0 topic in the codebox is implemented. I am also thinking about implementing new and() and or() functions to help cutting VNA expressions down in size. I see nothing insulting in referring to VNA specifications. I did say "please". The specifications are, obviously, inside codeboxes in that post. If you contradict it latter on, I am going with the earlier statement. I invested a lot of time into VNA emulator, and into nzero() function, in particular. It is natural for me to be peeved when after all that effort you inform me that it is not actually a function. <_< Also, my emulator does not have any problerms with any kinds of "backloops". As I said before, I wrote my own parser, which does not rely on any built-in Excel/VBA features, but goes through the input character by character, checking the syntax and interpreting and executing commands. I, arbitrarily set nesting limit to 100. The Emulator works for me, allowing to enter and run VNA programs and display the results. Fish2.2 as well as Fish3 included with the Workbook. I don't know what happened in your Excel. It could have something to do with the settings on your computer. (I presume, you have MS Excel installed.) I suggest the following procedure for downloading my Emulator. Press on the link I gave and the browser should ask you whether you want to open or save the file. You can save in the directory of your choice on your computer, making sure the file name has ".xls" extention. Or you can open it in the browser and then use "save as" from the file menu. When you open VNA workbook, all macros run in the background and should not should not show any programming code. I used MS Office2002 Excel version. Also, you should set your Excel options to medium or low macro security level. (From the top menu: Tools-Options-Security tab-Macro Security button.) It could be that you already have some macros default code in your Excel setup. And maybe that starts debugging whenever you open a workbook. Have you written or downloaded any marcros with Excel before? Maybe, FONH can give some suggestions. I am under impression, he has a thorough knowledge and understanding of the Excel. What version of Excel do you have?
  8. Prime

    I calculated same as Y-s probability for the first case, and different one for the second case. Or am I missing a simpler solution?
  9. Prime

    nzero(n) is an actual functions. Please, read VNA2.0 specifications. The nzero(n) returns zero if all three arguments of the node at offset n were zeros, otherwise it returns 1. I am using that function for my Fish4, which is designed to catch and destroy hoppers, such Fish2 and Ghost.
  10. Prime

    It did not work for me for some reason. Just increments the rounds counter, but does not move pointers. I get HTML message "error on the page". Meanwhile... I found and fixed another bug in my Emulatror. It was in the nzero function, which was getting an error unless "a" was non-zero. The corrected Emulator version is in the same place.
  11. Prime

    Good catch! I mainly used SHIFT command for my VNA programs and never tested JUMP command properly. There was a simple bug there -- I forgot to add current location to the argument "a". I put corrected VNA into the same place. Please download that new version and discard the old one. Thanks.
  12. Prime

    Another note: I did not implement smart equ() function, like Foolonthehill suggested. My parse() function evaluates arguments as it parses them. Thus, since the entire argument must be parsed, everything gets evaluated too. So, for now we, must avoid references leading to infinite regress, even when such references are not logically executable. Like a(1,1,1,a(0)) in argument "a", for example.
  13. Prime

    One additional note: When writing VNA program, you must start it from line 2, column 2 in the worksheet; and the program extends through line 41 of the worksheet (40 nodes). Any blank lines in that region will be converted to BLANK command. However, when you test an argument by selecting its cell and running VNA_Test macro, the node references (offsets) may range through the entire 200-node interval. That is from line 2 through 201 on the Worksheet. So if your argument refers to some other argument at node 150, you may want to put some number, or expression there for your test purposes. Otherwise, an empty cell evaluates as zero.
  14. Prime

    Can you give me a specific case, like the argument and the line where it was placed, so that I can test it? Does it happen in VNA_RUN worksheet, or in the in the worksheet containing your program when you run VNA_Test on an argument? I designed the Emulator to convert address references for 200-node queue. E.g., if you refer to the address -1 from the line zero, it should convert to 199. For example, a(-1) placed in the argument "a" at node zero should return whatever the argument "a" at the node 199 evaluates to. On the other hand, if the Emulator modifies non-address references -- that would be a bug. The address references are the arguments of a(), b(), and c(), and nzero() functions. Also, an "a" argument on any EDITx and JUMP command, "a" and "b" arguments of COPY, PCOPY, SWAP commands, and all three arguments on SHIFT command. For now the Emulator relies on the program to start at line 2, column 2 of the worksheet. It goes through the 4 columns, 40 lines from that point. Both VNA_Test and VNA_RUN (Load/Reset) count on it. This a shortcoming of the user interface. However, making it to pick up the entire program from an arbitrary point in the worksheet would require quite a bit of additional programming effort.
  15. Prime

    I think there may be more complexity and possibilities in VNA programs, than it seems at first glance. Hoppers have their advantages, but there are other considerations and effective methods. I published my emulator together with Fish2, Fish2.2, and Fish3 programs in the new topic VNA2.e. Currently I'm breeding another variety of fish, which should be effective at hunting and killing hoppers, such as Fish2 and Ghost. We shall have another tournament when my emulator is sufficiently tested and people have developed new better VNA-bots.
  16. Prime

    There is such thing as Excel Viewer, which, I presume, you can download from Microsoft for free. I'm not sure how it handles macros. Also, there is Open Office Org (OOO), a free software suit that matches closely Microsoft Office. I have one on my computer and I know you can open an MS Word document with it. Again, I never got around to check whether it can open/convert Excel with macros into its own format.
  17. Prime

    While there is just one solution for a (a=8), there are two possible solutions for t.
  18. Prime

    I upgraded my Fish2 into Fish2.2 and ran few matches against the evasive Ghost with the following results: Ghost......................Fish2.2 Start Loc. Result ...Start loc. Result....Rounds Comment ..0 ......... -1.........160.........+1..........57 ..160..........0.........0.............0..........3011.....I decided, if programs failed to kill one another in 3000 rounds - that's a draw ..0........... -1........ 121........+1..........23 ..121..........0..........0............0..........3000 ..0.............0..........144.........0...........--........Fish 2.2 ran over Ghost's pointer, whereupon 2 Fishes ran in a harmless cycle ..144..........0..........0............0...........< 100....Both treaded on the same spot fighting to put their signature bombs into same spot ..0..............0.........40..........40..........3200....Failed to kill one another ..40...........-1.........0...........+1...........56 But why Prime and Unreality should have all the fun? I have developed my Excel VNA Emulator to some useable point with some user interface and published it on the internet. I decided that warrants a start of a new topic VNA2.e where I give a link to download my emulator. This topic has run for 10 pages. So we can refresh and start new tournaments. Everyone is invited. Now you can test your VNA programs before submitting them for the tournament.
  19. Prime

    I have developed my own VNA emulator in Excel. Let's call it VNA2.e. You can download (or open and save) it from VNA2.e Of course, you must have MS Excel on your computer. The workbook contains macros (lot's of them) so you may need to change your browser's security settings to allow downloading/opening that file. It was a somewhat sizeable project (about 1500 lines of code). The emulator features own parser and a rudimentary user interface with input validation error checking. I did it to keep my programming skills alive and to learn programming in Excel. I'm sure, it is still full of bugs, so I could use help in testing it. Run your VNA programs in it and let me know if some commands or user interface do not perform as coded. The Emulator comes with 5 sample VNA warriors: Fish2, Fish2.2, and Fish3 (of my own design); and Awesome and Ghost (by Unreality copied from his VNA topic). The Worksheet "VNA Reference" contains information on how to operate the emulator. Have fun. We shall have another tournament soon.
  20. Prime

    JavaScript? I think you need some real language, to write a good VNA emulator. Like Java, for example. In my tests of your Ghost against my Fish2 that situation where both programs got stuck on the same spot happened several times. As for the ideal number to jump... That said, proper increment for bomb placing or jumping is not the only area for improvement. There are other considerations.
  21. Prime

    This problem This is an interesting solution! Much simpler than I thought. But, I think it needs a bit more work. The average segment length over an average chord seems to represent the average distance between two random points inside a circle. Although not all chords are of equal probability. When you consider a set of all parallel chords, each length occurs twice -- once on either side of the circle with a diameter as symmetry axis. The diameter, however, occurs only once. But since the diameter is just a line with a zero area, it may not affect the overall average length. The second part -- distance between random point and an average length segment inside the circle may be a little off. I think that the actual average may be a bit bigger. The reason: not every possible distance belongs to a chord inside the circle. Here is an illustration:
  22. Prime

    I have developed a VNA interpreter in Excel with own parser and some rudimentary user interface: command validation, error checking, and argument test. I'll test it some more and then publish a downloadable copy for common use. The interpreter runs each match in just a few seconds. If you want to observe a battle closely, it allows to execute one step at a time. It has a limitation -- a set limit for nesting currently set at 100. I just ran Ghost against Fish3 and Fish2 in my interpreter. Ghost did well against both of them. Most of the time it beat Fish3 with a few ties, when it copied its SHIFT command over Fish3's pointer and both pointers became Ghosts. Fish2 was built on a similar principle as Ghost, but in never managed to bomb it, whereas Ghost did bomb Fish2 few times. Most of the time those two programs end up running over each others pointers and chase each other endlessly. More often it was Fish2 that copied itself over Ghost. Then the entire field gets covered with bombs with only two SHIFT commands jumping around. I will write slightly improved version of Fish2 (Fish2.2) and see how it fairs against Ghost and against the last version of FOTH's Flawless.
  23. I checked my Google home page for hl=ru. News, weather, and Stock Market gadgets, all changed to Russian; Puzzles and Riddles gadget -- didn't.
  24. Prime

    Here is something I've been trying to figure out. Is it possible to use special characters in your post other than those provided with the editor here? In HTML you can precede a special character with the "&". For example, &int; displays the integral sign. I think, I have found the answer to my own question! Let's see: ∫ Wow, that's great! Let's try some more: ∀ ∏ ∑ ≠ ≤ Π ♣ The codes that I used above are: &forall; &prod; &sum; &ne; &le; &pi; &clubs; The way to do it is to press the little button "Toggle HTML Source" located in the upper left corner above the editing window, top row, second from the left. Then type your codes in the editor window, then press "SAVE HTML" button appearing at below the edit window in the middle. For encore, let's see if I can defeat replacing © with the copyright sign feature... Nope, that's too much to ask.
  25. Prime

    I am not sure I understand the condition. Bonanova has already posted same problem before. At least it is the same as Moe's probability. Which was found to be 14.7 rolls of die on average needed. For May the probability is as Nobody has calculated: On the other hand, if OP meant Moe must see 6 different numbers in a row, then we have a problem... At first glance it appears, that in this case May takes 6 turns while Moe takes one. But it is not so. Moe does not have a fixed position from which to start counting his 6 consecutive rolls. Let's say, the rolls 1 through 6 did not reach the objective, then it is still possibe for the rolls 2 through 7, or 3 through 8, and so on.
×
×
  • Create New...