|
Title: Core War Post by: Poor Lazlo on November 25, 2009, 09:02:17 AM So, when I was 13 or so, I was pretty obsessed with Core War (http://www.koth.org). For those not in the know, Core War is a game in which computer programs fight to the death, punching holes in each others' code and commandeering enemy processes. It's pretty exciting, in an extremely nerdy kind of way. There's some old Scientific American articles on the subject here (http://www.koth.org/info/akdewdney/index.html). I'm sorry if this paragraph seems patronising, I actually have no idea how well known the thing is.
Anyway, surfing idly I found that after about five years, I'm still third on the multiwarrior hill (a consequence of inactivity, I think, rather than unbeatable skill), which made me want to jump back in. From what I can tell, the corewar scene is just about dead, but is anyone still playing? Does anyone want to start? I figure if anyone is going to learn an involved game from twenty years ago, it'll be people on Tigsource. In any case, I'd like to find people to fight with my scanners. :gentleman: EDIT: If you want to play, I would recommend using CoreWin (I believe it will run in Wine). You can get it here (http://corewar.co.uk/wendell/). FURTHER EDIT: A list of resources, for if you wish to start playing! 1) A.K. Dewdney's original articles about corewar (http://www.koth.org/info/akdewdney/index.html). 2) An excellent GameSetWatch article describing corewar (http://www.gamesetwatch.com/2009/03/column_pixel_journeys_corewar_the.php). 3) Ilnari Karonen's Beginner's Guide to Corewar. (http://vyznev.net/corewar/guide.html) 4) The Corewar Wikipedia article. (http://en.wikipedia.org/wiki/Corewar) 5) Stephen Morell's My First Corewar Book, Chapters One (http://www.koth.org/info/chapter1.html) and Two (http://www.koth.org/info/chapter2.html). 6) The Corewar FAQ (http://bio.freelogy.org/wiki/REC.GAMES.COREWAR.FAQ). Title: Re: Core War Post by: JMickle on November 25, 2009, 09:04:52 AM it seems like a great idea, but would be much more popular if re-made rather than revived.
actually, it seems like and incredible idea. Title: Re: Core War Post by: Poor Lazlo on November 25, 2009, 09:17:56 AM It's very satisfying to play! A remade version would probably be more popular, but that means someone has to remake it... In the meantime, the existing game is still very functional, and if you have more than a passing interest in maths I would recommend it.
In any case, my MARS (Memory Array Redcode Simulator, for those who don't like acronyms) of choice is CoreWin, which you can find here (http://corewar.co.uk/wendell/). The link to it on koth.org is geocities and therefore broken. :( Title: Re: Core War Post by: jrjellybeans on November 25, 2009, 09:47:06 AM I don't understand what the real purpose of the game is.
Like, you point the game towards a program in your computer and then the game simulates a fight between them??? Title: Re: Core War Post by: PGGB on November 25, 2009, 09:52:15 AM I don't understand what the real purpose of the game is. No two people write a program which battle each other.Like, you point the game towards a program in your computer and then the game simulates a fight between them??? I tried to get into it at one time but resources were kinda scarce and there was no real community to speak of so I gave up. Title: Re: Core War Post by: C.A. Silbereisen on November 25, 2009, 09:53:56 AM So it's like these "robot battle" games?
Title: Re: Core War Post by: Poor Lazlo on November 25, 2009, 10:04:15 AM So it's like these "robot battle" games? Yes, except instead of programming a robot to fight, you are fighting with the actual programs, if that makes sense. So the two programs will try to overwrite each other, and make each other attempt to run unexecutable instructions. For example, the warrior "Dwarf": Code: ADD #4, 3 ; execution begins here MOV 2, @2 JMP -2 DAT #0, #0 This bit of code will copy the "DAT #0, #0" (DATs are unexecutable) every four locations around the core, in the hopes of overwriting a bit of the enemy code, and making it die. Does this make sense? I'm not very good at explaining this, I fear. I strongly advise everyone interested read this (http://vyznev.net/corewar/guide.html) guide to redcode. Title: Re: Core War Post by: Core Xii on November 25, 2009, 08:59:43 PM I'm into Core War. But... you're 3rd on a hill? I think you're way out of my league, I can't even beat the benchmarks let alone get on a hill.
I'm running a full-blown tournament against all 3 benchmarks to determine my best warrior, which I shall proceed to post here. Edit: I thought that would take longer. Yay for modern processors eh? Code: (Pitfall.rc) ;redcode-94 ;name Pitfall ;author Core Xii ;strategy .6c pit bomber -> three-pass core-clear ;assert CORESIZE == 8000 && MAXPROCESSES > 1 ;length 100 ORG 85 PIN 0 SPL.B #-1 , >1 SPL.B #-2 , >2 SPL.B #-3 , >3 SPL.B #-4 , >4 SPL.B #-5 , >5 SPL.B #-6 , >6 SPL.B #-7 , >7 SPL.B #-8 , >8 SPL.B #-9 , >9 SPL.B #-10 , >10 SPL.B #-11 , >11 SPL.B #-12 , >12 SPL.B #-13 , >13 SPL.B #-14 , >14 SPL.B #-15 , >15 SPL.B #-16 , >16 SPL.B #-17 , >17 SPL.B #-18 , >18 SPL.B #-19 , >19 SPL.B #-20 , >20 SPL.B #-21 , >21 SPL.B #-22 , >22 SPL.B #-23 , >23 SPL.B #-24 , >24 SPL.B #-25 , >25 SPL.B #-26 , >26 SPL.B #-27 , >27 SPL.B #-28 , >28 SPL.B #-29 , >29 SPL.B #-30 , >30 SPL.B #-31 , >31 SPL.B #-32 , >32 SPL.B #-33 , >33 SPL.B #-34 , >34 SPL.B #-35 , >35 SPL.B #-36 , >36 SPL.B #-37 , >37 SPL.B #-38 , >38 SPL.B #-39 , >39 SPL.B #-40 , >40 SPL.B #-41 , >41 SPL.B #-42 , >42 SPL.B #-43 , >43 SPL.B #-44 , >44 SPL.B #-45 , >45 SPL.B #-46 , >46 SPL.B #-47 , >47 SPL.B #-48 , >48 SPL.B #-49 , >49 SPL.B #-50 , >50 SPL.B #-51 , >51 SPL.B #-52 , >52 SPL.B #-53 , >53 SPL.B #-54 , >54 SPL.B #-55 , >55 SPL.B #-56 , >56 SPL.B #-57 , >57 SPL.B #-58 , >58 SPL.B #-59 , >59 SPL.B #-60 , >60 SPL.B #-61 , >61 SPL.B #-62 , >62 SPL.B #-63 , >63 SPL.B #-64 , >64 SPL.B #-65 , >65 SPL.B #-66 , >66 SPL.B #-67 , >67 SPL.B #-68 , >68 SPL.B #3 , >3 SPL.B #2 , >2 SPL.B #1 , >1 SPL.X #5871 , $5872 JMP.B $-1 , $-2937 JMP.B $-2936 , $0 ADD.F $2939 , $3 MOV.I $2938 , }2 MOV.I $2938 , *1 MOV.I @8808 , $11744 DJN.B $-4 , #499 NOP.F $1 , $6 SPL.A #2 , $6 SPL.B #5 , $6 MOV.I *-3 , >-3 JMP.B $-1 , <-2671 DAT.F $-5 , $6 MOV.I $-14 , $4159 MOV.I $-14 , $4159 MOV.I $-14 , $7093 MOV.I $-8 , $1223 MOV.I $-12 , $1219 SPL.B $1216 , $0 MOV.I $-16 , $1215 MOV.I $-16 , $1215 MOV.I $-14 , $1217 MOV.I $-16 , $1215 MOV.I $-21 , $1210 MOV.I $-14 , $1217 MOV.I $-13 , $1218 MOV.I $-15 , $1216 MOV.I $-18 , $1213 Title: Re: Core War Post by: Poor Lazlo on November 26, 2009, 08:19:08 AM I'm into Core War. But... you're 3rd on a hill? I think you're way out of my league... Not at all... I'm third on the multiplayer hill, which I believe to be the hill no-one cares about. In any case, I last did something in redcode five years ago, so I'm relearning from scratch. I just learned how an imp-ring works! It's pretty cool. Title: Re: Core War Post by: Hideous on November 26, 2009, 08:27:30 AM This looks waaaay too complicated for me. Fucking awesome, but complicated.
Title: Re: Core War Post by: Nikica on November 26, 2009, 11:19:23 AM This looks waaaay too complicated for me. Fucking awesome, but complicated. Title: Re: Core War Post by: Poor Lazlo on November 26, 2009, 11:30:02 AM This looks waaaay too complicated for me. Fucking awesome, but complicated. Well, fair enough. I will say, though, that it's a lot less complicated than it seems. As long as you can do modulo maths, you're golden. :) Title: Re: Core War Post by: Hideous on November 26, 2009, 11:52:23 AM Actually, I keep forgetting what modulo does (or atleast how to use it).
Title: Re: Core War Post by: brog on November 26, 2009, 12:18:25 PM Then call it "remainder" and you will not forget.
Title: Re: Core War Post by: Poor Lazlo on November 26, 2009, 12:29:40 PM Then call it "remainder" and you will not forget. Very true! Or imagine it is a big clock? Title: Re: Core War Post by: Dacke on November 26, 2009, 02:47:38 PM Edit: http://vyznev.net/corewar/guide.html (http://vyznev.net/corewar/guide.html) Title: Re: Core War Post by: Core Xii on November 26, 2009, 10:11:23 PM In any case, I last did something in redcode five years ago, so I'm relearning from scratch. Ah. Yeah, same here, it's been a while. We should totally arrange some sort of a tournament or something. Title: Re: Core War Post by: Poor Lazlo on November 27, 2009, 04:31:17 AM We should totally arrange some sort of a tournament or something. A tournament would be fun! I'd better get better. :) Title: Re: Core War Post by: Dacke on November 27, 2009, 05:18:29 AM Or let's start something and get better together! Learning together, so even total beginners like myself stand some sort of chance ;D
Title: Re: Core War Post by: Poor Lazlo on November 27, 2009, 07:52:17 AM I finished my first new warrior! It's pretty simple, and I shall post it here:
Code: ;corewar-94 ;name Toothy launch MOV bait, @bait ADD.AB clear, launch SUB clear, bait JMP launch bait JMP trap, 0 clear DAT #10, #0 trap SPL 1, <-60 MOV clear, <-1 JMP trap, <-11 END launch It's a vampire! From what I remember, these fell out of favour because they just weren't as good as other strategies, but I think they are at least the coolest. Anyway, it works a lot like the dwarf I posted before, but instead of dropping deadly DATs all over the core, it lays down JMP instructions which lead to the trap. The trap makes the enemy spawn countless new processes (which will slow down enemy operations), and uses these to execute a core clear, which will drop DAT bombs on every core address, wiping the entire core (except the bit my vampire occupies, of course). In short, it hijacks enemy processes, and make them run code that is to my benefit. I haven't bothered running it against any benchmarks, but I'm fairly confident it'll do crap. For starters, I need to choose a better step size than 10 (finding constants that are good is the most boring part of core war, in my opinion), and I'm sure there are lots of ways to make it smaller and more efficient. I think it's an okay first try though :) On a related note, I haven't been able to find any documentation on vampires (I wrote this from scratch, remembering how vamps act)... Has anyone else? Actually, I keep forgetting what modulo does (or atleast how to use it). Whoops, no-one actually told you... Basically, it is finding the remainder, like brog said. So 10mod3 is the remainder you get when you divide 10 by 3, which is 1. This is important in corewar because the space in which your programs fight is a loop. The average size of a core is 8000, where instructions 0 and 8000 are the same. Also, all locations are relative, so a program can never know exactly where in the core it is, only where it is relative to everything else. Title: Re: Core War Post by: Dacke on November 27, 2009, 09:26:55 AM Neat! Could you be bothered to explain the code in a bit more detail? I do understand how it works basically, but a small comment for each row would be a real treat :gentleman:
On a different topic: Would it be hard to set up a TIGS-hill? Title: Re: Core War Post by: Poor Lazlo on November 27, 2009, 11:22:58 AM Neat! Could you be bothered to explain the code in a bit more detail? I do understand how it works basically, but a small comment for each row would be a real treat. Absolutely! Code: ;corewar-94 <-- Using the '94 standard, not the '88 ;name Toothy <-- name (obv) launch MOV bait, @bait <-- Move the instruction "bait" to the location specified in its B-Field.(Indirect addressing with the @) ADD.AB clear, launch <-- Add the A-Field of clear to the B-field of bait. This means the bait will be sent 10 addresses ahead of last time. SUB clear, bait <-- subtract the same step from the bait, so bait is still pointing at the trap JMP launch <-- Loop back to launch bait JMP trap, 0 <-- The JMP instruction to be dropped across the core. The SUB instruction above keeps it pointing at the trap. Any process that comes upon the bait will therefore jump straight into the trap! The B-Field for JMPs are unused, so we can use it here to keep the address where each bomb should be dropped. 10 is added to this each time, so the JMPs are placed 10 spaces apart. Toothy is only 9 addresses long, so it never hits itself. clear DAT #10, #0 <-- The bomb used for the core-clear below. I used it to keep the step size of the attack as well. I should have just used a constant really, and kept this a DAT #0, #0, because then any scanners falling upon this instruction would see empty core, and move on. trap SPL 1, -60 <-- The trap! This SPL creates a new (enemy) process, which slows down the enemy as each process takes up one turn. A program with many processes becomes very slow. I also use the unused B-Field of the SPL to store the location for the core-clear to begin at. MOV clear, <-1 <-- This drops the DAT bomb "clear" at the location specified in "trap"'s B-field, decrementing it every time. This means the core-clear will put a dat in every address in the core, hopefully destroying everything that is not me. Eventually this will loop round and wipe itself, and the enemy processes trapped here will be killed. JMP trap, <-11 <-- This makes the enemy processes jump back to the SPL command, keeping them alive, and the enemy sluggish. The B-Field also decrements the address 11 spaces before it. This is called an imp-gate, and helps to kill imps (MOV 0, 1). END launch <-- This signifies to the MARS that the program should begin at "launch" (Somewhat unintuitive, but whatever). I hope that helps. :wizard: On a different topic: Would it be hard to set up a TIGS-hill? I have absolutely no idea. I shall have a look. Title: Re: Core War Post by: lokijki on November 27, 2009, 11:37:37 AM This looks fun, I'm just having trouble grasping the concept. I was reading through that tutorial and the code didn't make sense because I just don't know what its trying to accomplish or how you actually "win"; its very abstract as the guide said. I'm gonna keep reading and go re-read things and hopefully it'll start to make more sense.
Title: Re: Core War Post by: PGGB on November 27, 2009, 11:42:16 AM I feel like this (http://www.gamesetwatch.com/2009/03/column_pixel_journeys_corewar_the.php) article gives a good introduction to the concept.
Quote The programs do not manipulate vehicles in a physical system in an attempt to vanquish opposing vehicles, as with some other types of programming games. Instead, the programs try to directly destroy the opposing program by overwriting their code. A program thread dies only when it executes an illegal instruction or tries to divide by zero. A program wins when all opposing threads crash in this manner, and it loses if it, itself, is entirely crashed. Title: Re: Core War Post by: Poor Lazlo on November 27, 2009, 12:42:06 PM I feel like this (http://www.gamesetwatch.com/2009/03/column_pixel_journeys_corewar_the.php) article gives a good introduction to the concept. Quote The programs do not manipulate vehicles in a physical system in an attempt to vanquish opposing vehicles, as with some other types of programming games. Instead, the programs try to directly destroy the opposing program by overwriting their code. A program thread dies only when it executes an illegal instruction or tries to divide by zero. A program wins when all opposing threads crash in this manner, and it loses if it, itself, is entirely crashed. That's a great explanation. I think I'll add a list of resources to the first post. Title: Re: Core War Post by: Brother Android on November 27, 2009, 03:28:36 PM This looks pretty awesome. I don't know if I can comprehend it, though... whatever you say, it looks difficult. How can the modulus be used as a weapon?
Title: Re: Core War Post by: LemonScented on November 27, 2009, 05:18:36 PM I want to start playing this, I really do. Without wanting to blow my own trumpet, I have a hunch I'd be able to write some pretty evil beasties. I'm just worried that if i start, I'll wake up one day and realise I've lost a year of my life... I get sucked into stuff like this far too easily, and I've gots me a game to write.
Title: Re: Core War Post by: Dacke on November 27, 2009, 05:35:30 PM Thank you for you explanation, Lazlo!
This looks pretty awesome. I don't know if I can comprehend it, though... whatever you say, it looks difficult. How can the modulus be used as a weapon? You don't use modulus as a weapon. You just need to use modulus to figure things out. For example the program "Dwarf" bombs every fourth row by overwriting it with "DAT 0, 0". Code: ADD #4, 3 ;program start MOV 2, @2 JMP -2 DAT #0, #0 ;program end ... ... ... DAT #0, #0 ;first bomb It starts by bombing four rows under itself, then eight rows, then twelve rows and so on. The bombings will eventually reach 8000 rows. But as the core wraps around after 8000 rows, 8000 == 0. So the Dwarf then bombs 0 rows under itself (it bombs it's own DAT-row). The process then starts over. The neat thing is that it just misses bombing itself. Understanding how this works and using modulus to make such timings (and other modulus stuff) is probably a key skill when creating a warrior. A detailed explanation of how the Dwarf works can be found in this guide: http://vyznev.net/corewar/guide.html Title: Re: Core War Post by: Core Xii on November 28, 2009, 01:27:44 AM Code: launch MOV bait, @bait ADD.AB clear, launch SUB clear, bait JMP launch That's a pretty inefficient loop, .25 light speed. You should make it .34c by combining the ADD and SUB into a single instruction. Remember, ADD.F adds both fields of the source into the destination. For starters, I need to choose a better step size than 10 (finding constants that are good is the most boring part of core war, in my opinion) Here's the list of optimal step sizes: 1 3039 3359 2 3094 2234 4 3044 3364 5 2365 3315 8 2376 2936 10 2430 2930 I'm sure there are lots of ways to make it smaller and more efficient. I combined the ADD and SUB into a single ADD, and changed SPL 1 into SPL #0. The immediate mode makes the SPL always split into $0, regardless of the value in the A-field - Freeing it up as an extra data storage you can use for something else. The smallest possible step size is 4 for it to not bomb itself (it'll hit the last JMP in the trap, but that shouldn't matter. If it does, increment to 5) and the above table thus indicates the optimal step size is either 3044 or 3364, I chose the latter for aesthetics. You might want to add a bootstrap with a quickscan (too advanced for me) and to decoy scanners. Since this warrior relies on a core size of 8000 and splitting processes, you should add the assert directive to make sure those settings apply. Code: ;corewar-94 ;name Toothy ;edited by Core Xii ;assert CORESIZE == 8000 && MAXPROCESSES > 1 INTV equ 3364 ORG launch launch MOV bait, @bait ADD.F clear, bait JMP launch bait JMP -INTV+trap, INTV clear DAT #-INTV, #INTV trap SPL #0, <-60 MOV clear, <-1 JMP trap, <-11 END Title: Re: Core War Post by: Core Xii on November 28, 2009, 03:52:07 AM Here's my response to Toothy: Indie; Wins 47%, loses 7%, ties 46% (my edited version of Toothy ties considerably more at 61%)
Code: (Indie.red) ;redcode-94 ;name Indie ;author Core Xii ;strategy redirect stun bomber + DJN-stream ;assert CORESIZE == 8000 && MAXPROCESSES > 1 INTV equ 2234 org Bomb Bomb spl #2484, }0 Aim add.ab #INTV, Fire Fire mov Bomb, }INTV-INTV Strm djn.a Aim, }Bomb end Title: Re: Core War Post by: Poor Lazlo on November 28, 2009, 05:44:36 AM Code: launch MOV bait, @bait ADD.AB clear, launch SUB clear, bait JMP launch That's a pretty inefficient loop, .25 light speed. Ouch! Very true. I think I'll change it to something like this: Code: launch SPL #const, #-const loop MOV bait, @bait ADD.I launch, -1 JMP loop, <-50 END launch Similar to what you suggested, but the SPL 0 adds protection. I also used it to store the constant, so I don't have a coloured dat in the middle of my warrior (which will get picked up by scanners). It obviously doesn't guard against core-clears, but it's better than nothing. I changed SPL 1 into SPL #0. The immediate mode makes the SPL always split into $0, regardless of the value in the A-field - Freeing it up as an extra data storage you can use for something else. Hmm. I'm not sure that's better. Surely a SPL 0 will make the enemy processes survive the core clear they are running? The intention for the SPL 1 was that when the coreclear hit the MOV command, the enemy processes would split onto a DAT, and die. Maybe I need to step through this. For now, though, I'll leave it in. Looking at this, it should work with a step size of 5, so I'll use a constant of 2365. All in all, the new Toothy looks like this: Code: ;corewar-94 ;name Toothy 1.1 ;strategy Vamp ;author Daniel Rivas ;assert CORESIZE == 8000 && MAXPROCESSES > 1 const EQU 2365 launch SPL #const, #-const loop MOV bait, @bait ADD.I launch, -1 JMP loop, <-50 bait JMP trap, 0 clear DAT #0, #0 trap SPL 1, <-120 MOV clear, <-1 JMP trap, <-11 END launch Hmm. Out of 8000 rounds, Toothy and Indie seem to be pretty evenly matched: Tournament Results ================== Conditions ========== Melee with 2 warriors, 8000 rounds Score formula: (W*W-1)/S Core size Max processes Max cycles Max length Min distance --------- ------------- ---------- ---------- ------------ 8000 8000 80000 100 100 Summary ======= Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Toothy Daniel Rivas 0.87873 111.5 110.9 11.3 11.1 77.6 Indie Anonymous 0.87873 110.9 111.5 11.1 11.3 77.6 Title: Re: Core War Post by: Core Xii on November 28, 2009, 11:20:17 PM Hmm. I'm not sure that's better. Surely a SPL 0 will make the enemy processes survive the core clear they are running? The intention for the SPL 1 was that when the coreclear hit the MOV command, the enemy processes would split onto a DAT, and die. Maybe I need to step through this. For now, though, I'll leave it in. Ah, I didn't realize that was your intention. It's just that SPL 0 is more effective at stunning. Very good. Here's my new response, something quite different: Upstream. It's basically a single-instruction warrior. ;D Introducing bootstrapping, binary launch and the for-macro. Code: (Upstream.red) ;redcode-94 ;name Upstream ;author Core Xii ;strategy interlaced DJN-stream ;assert CORESIZE == 8000 && MAXPROCESSES > 1 CORE equ (CORESIZE-(MINDISTANCE*2)) NUM equ 91 org Boot Boot for NUM mov Strm, (Boot+MAXLENGTH)+((CORE/(NUM+1))*(1-Boot)) rof spl 1, 0 ;1 mov -1, 0 ;0 spl 1, 0 ;1 spl 1, 0 ;1 mov -1, 0 ;0 spl 1, 0 ;1 mov -1, 0 ;0 jmp @Boot, }0 Strm djn.f #1, }0 end Tournament Results ================== Conditions ========== Melee with 3 warriors, 800 rounds Score formula: (W*W-1)/S Core size Max processes Max cycles Max length Min distance --------- ------------- ---------- ---------- ------------ 8000 8000 80000 100 100 Summary ======= Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Upstream Core Xii 0,92729 329,0 265,0 12,6 4,6 31,3 Toothy 1.1 Daniel Rivas 0,92729 207,0 387,0 0,4 22,9 25,3 Indie Core Xii 0,92729 161,0 433,0 0,6 34,6 13,3 Title: Re: Core War Post by: Dacke on November 29, 2009, 03:20:22 PM Nice stuff! I'll try to put something together soon (even if I'll end up at the bottom of your list)
Title: Re: Core War Post by: Poor Lazlo on November 30, 2009, 07:33:02 AM Very good. Here's my new response, something quite different: Upstream. It's basically a single-instruction warrior. ;D Introducing bootstrapping, binary launch and the for-macro. Toothy is back again! I'm pretty unhappy with it, to be honest, but whatever. Code: (toothy.red) ;corewar-94 ;name Toothy 1.5 ;strategy Vamp ;author Daniel Rivas const EQU 2430 start SPL copy, 0 launch SPL #const, #-const loop MOV bait, @bait ADD.I launch, -1 JMP loop, <-50 bait JMP trap, 0 trap SPL 2, <-120 MOV clear, <-1 last JMP trap, <-11 copy JMZ.F 0, -300 MOV last, -350 SUB.F #1, -1 SUB.A #1, count JMZ.A -353, count JMP -4 DAT #0, #0 count DAT #9, #0 clear DAT #0, #0 END start Changing the SPL 1 in the trap to SPL 2 helps to make sure the enemy processes still die. The big change, though, is the copy code. This basically scans an area 300 addresses above toothy, and copies toothy there 50 if it detects a change. This hopefully moves toothy out of danger... Anyway, it's a pretty crap implementation. Oh well. I think that really just going for a straight replicator would be a better way to go. Possibly I should just sit down and make this thing better. Anyways, Upstream and Toothy now tie against each other almost every time: Results ================== Conditions ========== Melee with 2 warriors, 8000 rounds Score formula: (W*W-1)/S Core size Max processes Max cycles Max length Min distance --------- ------------- ---------- ---------- ------------ 8000 8000 80000 100 100 Summary ======= Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Toothy 1.5 Daniel Rivas 0.96754 104.9 98.7 2.8 0.8 96.4 Upstream Core Xii 0.96754 98.7 104.9 0.8 2.8 96.4 Title: Re: Core War Post by: Core Xii on November 30, 2009, 09:44:25 AM Oops, I've been running the tournaments in Melee rather than Round Robin. :-[ Explains the discrepancy between our numbers.
A scanner enters the hill: Twoosh. Inspired by yours, this warrior has two parallel loops, one that adds numbers and another that clears the core. Both loops' jump instructions work together as the scanner. Code: (Twoosh.red) ;redcode-94 ;name Twoosh ;author Core Xii ;strategy .5c stun scanner + .25c core-clear ;assert CORESIZE == 8000 && MAXPROCESSES > 1 INTV equ 2430 DIST equ 5 org Boot Boot spl Fire, Data+MINDISTANCE Aim add.f Data, Ptr jmz.a Aim, @Ptr mov Ptr, @Ptr Hit djn.f Aim, >Boot Fire mov Data, >Boot jmz.a Fire, *Ptr mov Ptr, *Ptr djn.f Fire, >Boot Ptr spl #Hit, }Hit+DIST Data dat {INTV, <INTV end Hint, use the Code: [tt] tag to make your tournament table monospace.Tournament Results ================== Conditions ========== Round robin with 4 warriors, 200 rounds per matchup Score formula: (W*W-1)/S Core size Max processes Max cycles Max length Min distance --------- ------------- ---------- ---------- ------------ 8000 8000 80000 100 100 Summary ======= Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Upstream Core Xii 0,84322 144,0 80,0 22,7 1,3 76,0 Twoosh Core Xii 0,68676 142,3 100,8 28,5 14,7 56,8 Toothy 1.5 Daniel Rivas 0,79269 88,2 139,2 5,2 22,2 72,7 Indie Core Xii 0,82416 85,2 139,7 3,3 21,5 75,2 I'd say we should roll with a hill format where all the existing warriors are fought also, for increased challenge. Upstream is still king of the hill. Do you think I should run more than 200 rounds per matchup? Would 800 suffice? I wouldn't care waiting for 8000. Title: Re: Core War Post by: Dacke on November 30, 2009, 10:06:00 AM I call for science!
How big is the difference between 200 and 800 rounds, is the difference relevant? Title: Re: Core War Post by: Poor Lazlo on November 30, 2009, 11:37:50 AM I call for science! How big is the difference between 200 and 800 rounds, is the difference relevant? Hmm. Well, after some experimentation, it seems like the results stop changing much after about 800 rounds, so is that okay? Title: Re: Core War Post by: Dacke on November 30, 2009, 01:06:06 PM Sounds good to me, I used 800 for the tournament below :)
So, here is my first attempt ever at this. I give you The 7-10 Split. It's written from scratch and ignores most conventions. Against bench-mark tests, it gets the lowest score together with Toothy. But it stands as the proud champion of the TIGShill :wizard: Code: ;redcode-94 ;name The 7-10 Split ;author Dacke ;strategy Quick bombing run, followed by dual DJN streams ;assert CORESIZE == 8000 && MAXPROCESSES > 1 ;assert MAXLENGTH == 100 && MINDISTANCE == 100 space EQU 75 ORG Bombrun Upstream DJN #-100, {0 Bombrun FOR 97 mov {(100+space/2+space*(-1*Bombrun)), {(100+space+space*(-1*Bombrun)) ROF SPL Upstream, <4000 DJN #102, }0 END Conditions ========== Round robin with 4 warriors, 800 rounds per matchup Score formula: (W*W-1)/S Core size Max processes Max cycles Max length Min distance --------- ------------- ---------- ---------- ------------ 8000 8000 80000 100 100 Summary ======= Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ The 7-10 Split Dacke 0,76662 130,0 99,2 19,7 9,5 70,8 Toothy 1.5 Daniel Rivas 0,92339 117,7 94,5 10,0 2,3 87,8 Upstream Core Xii 0,79560 112,5 111,7 12,3 12,0 75,8 Indie Core Xii 0,80474 86,5 141,2 4,7 23,0 72,3 Title: Re: Core War Post by: Dacke on November 30, 2009, 01:22:03 PM Whoops, I missed Twoosh! Twoosh is the new champion of the hill :)
Tournament Results ================== Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Twoosh Core Xii 0,68493 135,2 109,4 26,6 18,0 55,5 The 7-10 Split Dacke 0,73739 129,0 105,3 21,1 13,2 65,7 Upstream Core Xii 0,77945 124,8 103,8 17,8 10,8 71,4 Toothy 1.5 Daniel Rivas 0,81001 100,9 126,0 9,3 17,7 73,1 Indie Core Xii 0,80113 91,2 136,7 6,3 21,5 72,2 Title: Re: Core War Post by: Core Xii on November 30, 2009, 01:53:44 PM Huh.
Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ The 7-10 Split Dacke 0,74133 133,3 100,2 22,3 11,2 66,5 Twoosh Core Xii 0,69324 131,7 111,6 25,0 18,3 56,7 Upstream Core Xii 0,77629 125,5 103,4 18,1 10,8 71,1 Toothy 1.5 Daniel Rivas 0,81477 97,7 128,4 7,9 18,2 73,9 Indie Core Xii 0,81561 91,2 135,7 6,0 20,8 73,1 So apparently 800 rounds isn't enough after all. It takes forever to run 8000 rounds. Oh well. Edit: I'll try 3200. Title: Re: Core War Post by: Dacke on November 30, 2009, 02:18:48 PM Hm, I guess we have to up it from 800. But not all the way to 8000, hopefully. 4000 rounds takes about 10 minutes on my computer:
Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Twoosh Core Xii 0,68543 133,5 111,1 26,0 18,5 55,4 The 7-10 Split Dacke 0,74474 131,4 102,0 21,6 11,8 66,6 Upstream Core Xii 0,77790 126,5 102,5 18,5 10,5 71,0 Toothy 1.5 Daniel Rivas 0,81225 100,4 126,2 9,0 17,6 73,5 Indie Core Xii 0,80461 89,0 139,1 5,7 22,4 71,9 Title: Re: Core War Post by: Core Xii on November 30, 2009, 02:57:19 PM If we limit the hill to 10 warriors, 3200 rounds per matchup, that gives a total of 144,000 rounds or some half an hour to run by your estimate.
Here's a comparison with 3200 and 4000 rounds: Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Twoosh Core Xii 0,68045 134,8 109,9 26,5 18,2 55,3 Twoosh Core Xii 0,68543 133,5 111,1 26,0 18,5 55,4 The 7-10 Split Dacke 0,74878 129,4 103,3 20,7 12,0 67,4 The 7-10 Split Dacke 0,74474 131,4 102,0 21,6 11,8 66,6 Upstream Core Xii 0,77444 127,8 101,5 19,0 10,3 70,8 Upstream Core Xii 0,77790 126,5 102,5 18,5 10,5 71,0 Toothy 1.5 Daniel Rivas 0,81134 99,5 126,9 8,6 17,8 73,6 Toothy 1.5 Daniel Rivas 0,81225 100,4 126,2 9,0 17,6 73,5 Indie Core Xii 0,80040 89,1 139,0 5,7 22,4 71,9 Indie Core Xii 0,80461 89,0 139,1 5,7 22,4 71,9 We find the largest difference is 2 points. Since Twoosh and The 7-10 Split contend on the fine margin, I vote we sacrifice speed for accuracy, and limit the size of the hill instead. There's the three of us now playing; I'd say 2 warriors each, for a hill size of 6 (plus the 7th warrior contesting the hill). If other people join in we can reconsider. Opinions? Title: Re: Core War Post by: Dacke on November 30, 2009, 04:04:59 PM Hm, those are some interesting results. I agree on having a limited hill size and to go for accuracy over speed. But I really don't mind that you have more than two warriors on the hill. Perhaps we can have it so that each player is guaranteed to have one warrior on the hill at all times (for interesting comparisons) but the rest of the spaces have to be fought over? Or something like that :durr:
Two minor changes on the Split. I realized I could use modifiers! Learning the battlefield is half the fun. Just swapping DJN for DJN.I puts it in a pretty firm lead (even though Twoosh actually wins more!) Code: ;redcode-94 ;name The 7-11 Split ;author Dacke ;strategy Quick bombing run, followed by dual DJN streams space EQU 75 ORG Bombrun Upstream DJN.I #-100, {0 Bombrun FOR 97 mov {(100+space/2+space*(-1*Bombrun)), {(100+space+space*(-1*Bombrun)) ROF SPL Upstream, <4000 DJN.I #102, }0 END 4000 rounds: Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ The 7-11 Split Dacke 0,70358 143,5 92,4 26,5 9,4 64,1 Twoosh Core Xii 0,63534 132,3 118,2 27,6 22,9 49,5 Upstream Core Xii 0,77669 126,4 102,8 18,5 10,7 70,8 Indie Core Xii 0,79016 91,4 137,6 6,8 22,2 70,9 Toothy 1.5 Daniel Rivas 0,83194 89,9 132,5 4,1 18,3 77,6 Title: Re: Core War Post by: Core Xii on December 01, 2009, 12:40:58 PM Since you snagged first place I had to design a new scanner, one that locks onto The 7-11 Split efficiently. I have a feeling there's more potential in the DJN.F #x, }0 instruction, but you'll definitely need to bootstrap your code to escape my scan now.
Code: (Chocolate milk.red) ;redcode-94 ;name Chocolate milk ;author Core Xii ;strategy .67c mod-8 B-field CMP scanner + SPL/DAT carpet ;assert CORESIZE == 8000 && MAXPROCESSES > 1 INTV equ 2936 org Scan Pass dat Bomb, Bomb+1 Aim add.ab #INTV+1, Scan Scan sne.b <0, Hit+INTV djn.b Aim, #703 ;hardcoded for INTV 2936 mov.b Scan, Pass Hit spl Aim, 1+Pass Fire mov.i *Pass, >Pass jmp Fire, >Pass-2666 Bomb spl #1-Pass, 1-Pass end Tournament Results ================== Conditions ========== Round robin with 6 warriors, 4000 rounds per matchup Score formula: (W*W-1)/S Core size Max processes Max cycles Max length Min distance --------- ------------- ---------- ---------- ------------ 8000 8000 80000 100 100 Summary ======= Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Chocolate milk Core Xii 0,55343 206,7 63,6 59,0 11,3 29,7 The 7-11 Split Dacke 0,65080 124,5 122,2 23,7 23,0 53,3 Twoosh Core Xii 0,59943 122,5 134,4 26,4 30,4 43,2 Upstream Core Xii 0,78109 113,2 118,1 14,8 16,4 68,8 Indie Core Xii 0,78352 92,9 137,6 7,8 22,7 69,6 Toothy 1.5 Daniel Rivas 0,74584 76,3 160,2 4,3 32,2 63,5 Damn, 80 points difference to nearest competitor, color me impressed. What are your opinions on hill size? That's 6 warriors now, and it took 19 minutes to simulate. Think we should start dropping them off the hill from here? Title: Re: Core War Post by: Poor Lazlo on December 03, 2009, 04:59:36 AM Back... Being ill is no fun. Hey, toothy is last, so that's no good. I'll come up with something to change that, I think.
What are your opinions on hill size? That's 6 warriors now, and it took 19 minutes to simulate. Think we should start dropping them off the hill from here? I think 6 is probably a decent size, seeing as it looks like there are only three combatants right now. Title: Re: Core War Post by: Dacke on December 03, 2009, 06:37:33 AM Yup, sounds good to me too :)
So we use 7 warriors per tournament, but the bottom one is kicked out for the next tournament? I have been trying a few things with the split. I think it has no chance to beat Chocolate. But I can make it bridge the gap a bit. I'll post an updated version later, and then move on to a different strategy :) Edit: Oh, and nice to see you well and back Lazlo! ;D Title: Re: Core War Post by: Poor Lazlo on December 03, 2009, 11:57:23 AM Okay, I have a new warrior. Meet Glasses Glasses:
Code: ;corewar-94 ;name Glasses Glasses ;author Daniel Rivas ;strategy 0.8c CMP Scanner + immediate Core-Clear. step EQU 2930 hop EQU 30 start EQU 10 scanD ADD incD, ptrD ptrD SNE start+hop, start ADD incD, ptrD SNE *ptrD, @ptrD DJN scanD, #800 attack MOV incD, @ptrD incD SPL #step, #step MOV.I clr, <scanD DJN.I -1, <scanD clr DAT #0, #0 end ptrD It's a CMP-Scanner, and it could do with some better attack code. Oh well. It does okay on the hill, jumping to number 2. Chocolate Milk retains its crown. My next warrior will be stone, I think, to try and drop Core Xii's warrior down a few ranks :). Conditions ========== Round robin with 7 warriors, 4000 rounds per matchup Score formula: (W*W-1)/S Core size Max processes Max cycles Max length Min distance --------- ------------- ---------- ---------- ------------ 8000 8000 80000 100 100 Summary ======= Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Chocolate milk Core Xii 0.52235 213.6 61.0 62.8 11.9 25.4 Glasses Glasses Daniel Rivas 0.60736 135.3 112.5 27.7 20.1 52.2 The 7-11 Split Dacke 0.64793 119.2 126.6 21.6 24.1 54.2 Twoosh Core Xii 0.58147 115.7 141.1 24.2 32.6 43.2 Upstream Core Xii 0.81336 111.1 115.6 12.6 14.1 73.3 Indie Core Xii 0.75940 89.7 142.5 7.3 24.9 67.7 Title: Re: Core War Post by: Core Xii on December 03, 2009, 12:10:49 PM I love this little war we have going on here.
You should post the full 7-warrior table from the tournament so we can see how the warrior that fell off the hill did. Title: Re: Core War Post by: Poor Lazlo on December 03, 2009, 12:48:36 PM You should post the full 7-warrior table from the tournament so we can see how the warrior that fell off the hill did. Oh, okay: Results ================== Conditions ========== Round robin with 7 warriors, 4000 rounds per matchup Score formula: (W*W-1)/S Core size Max processes Max cycles Max length Min distance --------- ------------- ---------- ---------- ------------ 8000 8000 80000 100 100 Summary ======= Warrior Author Length Score Given W% L% T% ------- ------ ------ ----- ----- ------ ------ ------ Chocolate milk Core Xii 0.52235 213.6 61.0 62.8 11.9 25.4 Glasses Glasses Daniel Rivas 0.60736 135.3 112.5 27.7 20.1 52.2 The 7-11 Split Dacke 0.64793 119.2 126.6 21.6 24.1 54.2 Twoosh Core Xii 0.58147 115.7 141.1 24.2 32.6 43.2 Upstream Core Xii 0.81336 111.1 115.6 12.6 14.1 73.3 Indie Core Xii 0.75940 89.7 142.5 7.3 24.9 67.7 Toothy 1.5 Daniel Rivas 0.71330 76.5 161.8 4.9 33.4 61.7 Badly. Hmm. It gave a lot. Toothy's results are as follows: vs. Toothy 1.5 Author Length Score Given W% L% T% -------------- ------ ------ ----- ----- ------ ------ ------ Chocolate milk Core Xii 0.39365 270.0 23.6 87.8 5.7 6.4 Twoosh Core Xii 0.48271 227.4 40.2 65.0 2.6 32.4 Glasses Glasses Daniel Rivas 0.55964 172.5 73.7 39.6 6.7 53.8 The 7-11 Split Dacke 0.96318 105.8 98.6 3.4 1.0 95.6 Upstream Core Xii 0.96908 98.7 104.7 0.7 2.7 96.6 Indie Core Xii 0.91156 96.5 118.2 3.8 11.0 85.2 Perhaps without toothy feeding your warriors wins, Chocolate Milk won't have quite such a lead. Perhaps! Either way, I need to up my game. Title: Re: Core War Post by: Core Xii on December 08, 2009, 03:47:21 AM Although we are nowhere near that point, I thought I'd share something: I wrote a PHP P^3 table generator (http://corexii.com/corewarp3.php) as described in the Core Warrior issue 70. (http://corewar.co.uk/cw/cw070.txt)
It's not perfect; In particular I couldn't figure out how to parameterize the table columns layout (it's fixed at Loss, Win, Tie), and the last state cannot loop back to itself on a win. If anyone understands this crazy shit, please do that. ::) It's a PHP script with hard-coded input, so you need your own PHP-enabled host to use it. Too lazy to implement an HTML form for editing the states table. Edit: Oh yea, and I didn't actually test the randomization of the P-space address that stores the state, I just assumed it works. Replace the variable P shit with a static address if it doesn't. Title: Re: Core War Post by: Epitaph64 on December 08, 2009, 10:51:34 PM Ah man, if I didn't have finals coming up in two days I'd try and join you guys, but I have never played nor used the language. However, if you guys want to have a tournament and set a data sometime at least 2 weeks from now, I may be interested :lol: This is just the kind of geeky thing that I love haha.
EDIT: Out of curiosity, what exactly randomizes the results? Is it a scripted randomness of some sort, or just a random starting memory location, or a combination, or what? Title: Re: Core War Post by: Dacke on December 08, 2009, 11:25:54 PM Ah man, if I didn't have finals coming up in two days I'd try and join you guys, but I have never played nor used the language. However, if you guys want to have a tournament and set a data sometime at least 2 weeks from now, I may be interested :lol: This is just the kind of geeky thing that I love haha. EDIT: Out of curiosity, what exactly randomizes the results? Is it a scripted randomness of some sort, or just a random starting memory location, or a combination, or what? I knew nothing about the game when this started, so I'm sure you'll be able to join in just fine! And no hurry either. This is the kind of thing we can keep going indefinitely, so we'll be right here where you left us :) The random part is indeed the starting positions. Each warrior can be max 100 rows long and the minimum distance between two warriors is 100 rows. Apart from that, the warrior opposing you can be anywhere in the 8000-row-core. Title: Re: Core War Post by: Epitaph64 on December 08, 2009, 11:56:19 PM Am I doing something wrong, or do those battle times seem exceptionally long. I can easily do 4,000 1v1 battles in around 30 seconds?
Hmm, was experimenting a little bit. I'm confused as to why MOV 0,1 fills the core and results in a draw, whereas MOV 0,2 kills itself? Title: Re: Core War Post by: Dacke on December 09, 2009, 09:48:05 AM Am I doing something wrong, or do those battle times seem exceptionally long. I can easily do 4,000 1v1 battles in around 30 seconds? We are doing a round robin tournament. Every warrior fights every other warrior 4000 times. And with many of our warriors, the game won't come to an early end. The game ends if someone wins or if the CoreWin program can identify an early draw (which is why MOV 0,1 vs. MOV 0,1 can be ended early). Otherwise every round ends after 80000 cycles. With seven warriors, each fighting each other you get 21 matchups. If each round takes 30 seconds, the whole thing would take 10.5 minutes. But as I mentioned, the warriors currently on the hill have a tendency to drag thing out to the very end (as opposed to making fast kills). Hmm, was experimenting a little bit. I'm confused as to why MOV 0,1 fills the core and results in a draw, whereas MOV 0,2 kills itself? I will try to show you what happens when the two programs execute. I will user a '>' to mark where the program currently "is" (the next row to be executed). The program executes a row, then it moves on to the next row. To begin with the core is filled with DAT 0, 0. If the program executes such a row it dies. Every row that has not been changed by a program looks like this. I put down only a few of them here, but they continue for hundreds or thousands of rows in both directions. The Imp (MOV 0,1) program: Code: DAT 0, 0 ;empty-core-row. DAT 0, 0 > MOV 0, 1 ;this is the only row in the program, it is the first to be executed. DAT 0, 0 DAT 0, 0 DAT 0, 0 DAT 0, 0 When executing the row the program copies (MOV) "the current row" (0) to "the next row" (1). Then it moves on, to execute the next row in the program. Code: DAT 0, 0 DAT 0, 0 MOV 0, 1 ; this was just executed. It copied itself to the next row. > MOV 0, 1 ; this row was just "created". It is now the next instruction to be executed DAT 0, 0 DAT 0, 0 DAT 0, 0 The program then contiues like this. Copying a row and then moving to the newly created row. Code: DAT 0, 0 DAT 0, 0 MOV 0, 1 ; the starting row MOV 0, 1 ; this was just executed. It copied itself to the next row. > MOV 0, 1 ; this row was just "created". It is now the next instruction to be executed DAT 0, 0 DAT 0, 0 The (MOV 0, 2) program: Code: DAT 0, 0 ;empty-core-row. DAT 0, 0 > MOV 0, 2 ;this is the only row in the program, it is the first to be executed. DAT 0, 0 DAT 0, 0 DAT 0, 0 DAT 0, 0 The program copies (MOV) itself (0) to the second-next row (2). The program then moves on to execute the next row. Code: DAT 0, 0 DAT 0, 0 MOV 0, 2 ; this was just executed. It copied itself two rows down > DAT 0, 0 ; this is the next row to be executed MOV 0, 2 ; this row was just "created" DAT 0, 0 DAT 0, 0 And now the program dies, as it executes a DAT 0, 0 If you feel like it, see if you can figure out how this program would work: Code: > MOV 0, 2 MOV 0, 2 Title: Re: Core War Post by: Epitaph64 on December 09, 2009, 11:51:59 AM Ah that makes sense. So does the program's execution always go one forward unless told to jmp? That's probably why I could never make anything that worked, because I thought that by telling something to move or add that the next instruction would execute at that point :P
My other new question is, for the jmp command, does it only use field A? If so, is the only reason to declare a field B for the jmp command to use it as a reference data number in your core? I read a few of the tutorials briefly, but I still have no idea what all the opcodes do (haven't found a nice listing) and it seems like the field A and B of certain commands are hard to locate their functions for the instruction. Title: Re: Core War Post by: Dacke on December 09, 2009, 12:18:38 PM Good! :)
Just like in ordinary programming, the program/warrior is executed one line at a time. If you want some code to be repeated, skipped or jumped to you can use JMP, JMZ, JMN, DJN, CMP/SEQ, SNE or SLT JMP only cares about the A field. But the B field can be used for other stuff. You can use the extra field to store values. Or use it with special addressing modes. For example JMP -3, {-50 does: jump to -3 AND subtract one from the A-field of the row at -50. The tutorial I recommend reading thoroughly (at least to begin with) is http://vyznev.net/corewar/guide.html In that guide you can find descriptions of all OpCodes (http://vyznev.net/corewar/guide.html#start_instr) and details about all the OpCodes (http://vyznev.net/corewar/guide.html#deep_instr) (but to understand them, you may need to read the rest of the document). How the A and B fields are used by different OpCodes can be changed by the use of modifiers, too. But you'll learn all that if you read that guide! Title: Re: Core War Post by: Epitaph64 on December 09, 2009, 08:31:08 PM Ah, I find that the symbols used are quite confusing. It says "{ -- A-field indirect with predecrement" which makes no sense to me at all haha.
Title: Re: Core War Post by: Poor Lazlo on December 10, 2009, 06:43:00 AM Ah, I find that the symbols used are quite confusing. It says "{ -- A-field indirect with predecrement" which makes no sense to me at all haha. That means that it will go and use the value of the A-Field of the instruction referenced, but first it will decrement the A-field of that instruction. So, for example: Code: MOV 37, 28 JMP {-1 If the JMP {-1 instruction is executed, it will decrement the MOV instruction, and then JMP to the value stored in the MOV's A-field. That is to say, 36 instructions after. Hope that helps. :) Title: Re: Core War Post by: Dacke on December 10, 2009, 10:39:28 AM I found (and still find) much of that stuff confusing too, so no worries. If you have time to experiment later, I'm sure you'll be able to find out how to make things work.
A way to make experimenting easy in CoreWin:
Title: Re: Core War Post by: Brother Android on December 10, 2009, 02:48:09 PM Cool. I thought this would be way out of my league but I'm actually starting to get a handle on it, and it sounds pretty interesting.
Title: Re: Core War Post by: Epitaph64 on December 10, 2009, 06:19:46 PM Ah thanks Dacke, that helps quite a bit. Well, I finished my finals today, and ordered my new computer online, so this may be just the mind-absorbing thing to take my attention away from the package deliveries. :biglaff:
Title: Re: Core War Post by: Core Xii on December 10, 2009, 06:20:25 PM Ah, I find that the symbols used are quite confusing. It says "{ -- A-field indirect with predecrement" which makes no sense to me at all haha. If you're a programmer, it's easy to think of it like this: JMP {Addr goto *(--Addr.A); Decrement the A-field of Addr by one, then jump to the instruction it points to. Wait, I just made it even more confusing, didn't I? That's not how pointers actually work. Haha. Title: Re: Core War Post by: Poor Lazlo on December 11, 2009, 05:36:38 AM Wait, I just made it even more confusing, didn't I? That's not how pointers actually work. Haha. Whoops! I thought it was a pretty good explanation. :beer: Title: Re: Core War Post by: Epitaph64 on December 11, 2009, 10:09:22 PM Ah I see, that makes a lot more sense, thanks.
Title: Re: Core War Post by: Core Xii on December 13, 2009, 05:24:21 AM I've been evolving nano warriors for a few days now.
(http://corexii.com/maezumo_thumb.jpg) (http://corexii.com/maezumo.png) The little buggers have been steadily climbing in benchmark scores, starting from around 50 and now at almost 140. They still finish near last in a round-robin against the benchmark, but I expect that to change soon when I break 150. The general strategy (so far) is SPL #0, MOV, MOV, MOV, DJN -3 Title: Re: Core War Post by: Core Xii on December 25, 2009, 08:10:49 AM I compiled the table of the most efficient codes for generating N parallel aka online processes (each process executes the same instruction in sequence) up to 12.
The Offline column contains more compact code but isn't fully parallel, so only use it if you're fine with some processes executing 1 instruction ahead of the rest! Code: N Online Offline 2 spl 1, xxx 3 spl 2, xxx spl 0, }0 spl 1, yyy 4 spl 1, xxx spl 1, yyy 5 spl 2, xxx spl 0, }0 spl 2, yyy mov.i spl1, #qqq spl 1, zzz 6 spl 2, xxx spl 0, }0 spl 1, yyy spl 1, xxx spl 1, zzz 7 spl 1, xxx spl }0, xxx spl 1, }0 spl 0, yyy spl 1, yyy 8 spl 1, xxx nop xxx, 1 spl 1, yyy spl @-1, }0 ; start here spl 1, zzz spl 1, yyy 9 spl 2, xxx spl 0, }0 spl 2, yyy mov.i -1, #qqq spl 1, }0 spl 1, xxx spl 1, zzz 10 spl 2, xxx spl 0, }0 spl 2, yyy mov.i 1, #qqq spl 1, zzz spl 1, xxx spl 1, www 11 spl 1, xxx spl 0, }0 spl 1, }0 spl 1, xxx spl 2, yyy mov.i -1, #qqq spl 1, zzz 12 spl 2, xxx spl 1, yyy spl 1, zzz spl 1, www I improved my P^3 generator (http://corexii.com/corewarp3.php) (source (http://corexii.com/corewarp3.php?source)). It's cleaner, has added optional brainwash protection and I figured out how to customize the table columns. If asked politely I'll provide an HTML form interface for using that thing. Please note that in all my postings, nop can be replaced by any desired opcode, xxx, yyy, zzz and www can be replaced by any desired value (and any address modifier) and qqq can be replaced by any desired value, but is lost upon execution. Also, where's my challenger?? It's lonely atop the hill! :concerned: Title: Re: Core War Post by: Dacke on December 25, 2009, 08:28:38 AM Advanced stuff :o
But pretty interesting! I'll try to create a challenger later, perhaps in a month :) Title: Re: Core War Post by: Core Xii on December 25, 2009, 12:45:11 PM Phew. I put together a Q^4.5 as described in the Core Warrior issue 92. (http://corewar.co.uk/cw/cw092.txt)
Code: (Q^4.5.red) ;redcode-94 ;name Q^4.5 ;author Core Xii ;strategy Q^4.5 ;assert CORESIZE == 8000 qM equ 160 ; qm qN equ 6239 ; qM qOffs equ -88 ; offset of second bomb trail qBombs equ 20 ; number of bombs to throw qIntv equ -7 ; distance between bombs qEnd equ boot org qScan qA1 equ (((qTab1-1-qPtr)*qN)+1) qA2 equ (((qTab1-qPtr)*qN)+1) qB1 equ (((qTab2-1-qPtr)*qN)+1) qB2 equ (((qTab2-qPtr)*qN)+1) qB3 equ (((qTab2+1-qPtr)*qN)+1) qC2 equ (((qTab3-qPtr)*qN)+1) nop 0, qB1 qTab2 nop 0, qB2 nop 0, qB3 qScan sne.i qPtr+(qM*qC2), qPtr+(qM*qC2)+qB2 seq.i <qTab3, qPtr+(qM*(qC2-1))+qB2 jmp q0, }q0 sne.i qPtr+(qM*qA1), qPtr+(qM*qA1)+qB2 seq.i <qTab1-1, qPtr+(qM*(qA1-1))+qB2 djn.a q0, {q0 sne.i qPtr+(qM*qA2), qPtr+(qM*qA2)+qB2 seq.i <qTab1, qPtr+(qM*(qA2-1))+qB2 jmp q0, {q0 sne.i qPtr+(qM*qB1), qPtr+(qM*qB1)+qB1 seq.i <qTab2-1, qPtr+(qM*(qB1-1))+(qB1-1) jmp q0, {q1 sne.i qPtr+(qM*qB3), qPtr+(qM*qB3)+qB3 seq.i <qTab2+1, qPtr+(qM*(qB3-1))+(qB3-1) jmp q0, }q1 sne.i qPtr+(qM*qB2), qPtr+(qM*qB2)+qB2 seq <qTab2, qPtr+(qM*(qB2-1))+(qB2-1) jmp q0, <qPtr+(qM*qB2)-1 seq.i >qPtr, qPtr+qM+(qB2-1) jmp qSel, <qPtr seq.i qPtr+((qM+1)*(qC2-1)), qPtr+((qM+1)*(qC2-1))+(qB2-1) jmp q0, }q0 seq.i qPtr+((qM+1)*(qA2-1)), qPtr+((qM+1)*(qA2-1))+(qB2-1) jmp q0, {q0 seq.i qPtr+((qM+1)*(qA1-1)), qPtr+((qM+1)*(qA1-1))+(qB2-1) djn.a q0, {q0 jmz.f qEnd, qPtr+((qM+1)*(qB2-1))+(qB2-1) nop 0, 0 qTab3 dat.f >qOffs, >qC2 nop 0, 0 nop 0, 0 nop (qTab2-2), qA1 ;point A-field to empty core qTab1 nop (qTab2-2), qA2 ;point A-field to empty core boot djn.a #100, #0 dat 0, 0 for 54 nop 0, 0 rof q0 mul.b *q1, qPtr qSel sne.i *qTab1, @qPtr q1 add.b qTab2, qPtr qFire mov.i qTab3, @qPtr qPtr mov.i qTab3, }qM sub.ab #qIntv, qPtr djn.b qFire, #qBombs jmp qEnd, 0 end Edit: I optimized it a bit. Title: Re: Core War Post by: Core Xii on January 06, 2010, 11:13:28 PM Holy shit! My evolved nano warrior got 14th on the KOTH@SAL nano hill (http://sal.math.ualberta.ca/hill.php?key=nano)! :monoclepop:
Title: Re: Core War Post by: Poor Lazlo on January 07, 2010, 12:00:53 AM :handclap::gentleman:
Oh god I just realised that thing has three arms. Title: Re: Core War Post by: lnsine on January 13, 2010, 09:36:44 PM Just recently read this and spent the last night reading the material, very interesting game!
I'm working on a scanner at the moment, and might be able to contribute to the hill, but I'm not doing too well at the moment. Don't let this die though! >:D Title: Re: Core War Post by: Core Xii on January 30, 2010, 06:15:25 AM Come on people, don't leave me up here. :yawn:
Title: Re: Core War Post by: Core Xii on May 10, 2011, 10:44:51 AM Anyone doing this anymore?
Title: Re: Core War Post by: Dacke on May 11, 2011, 01:47:03 AM It keeps popping up in the back of my mind, but I have yet to actually do something. I think I want to attack the problem using some kind of evolution or meta-AI. But I would have to learn to do that stuff efficiently first, I guess.. hm.
|