[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/lv/ - Libre Vidya

Video Games in Freedom

Catalog

8chan Bitcoin address: 1NpQaXqmCBji6gfX8UgaQEmEstvVY7U32C
The next generation of Infinity is here (discussion) (contribute)
A message to the "victims" of Adelaide and the news publications writing about their "plight"
Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 5 per post.


File: 1434465916323.jpg (33.82 KB, 480x360, 4:3, pmars.jpg)

 No.843

I made a thread about it on /tech/ but it seems it's too techy to compete with browser wars and NSA.

>What is corewars?

Basically you write programs in Redcode, which is RISC assembly with stuff like

multithreading and relative addressing. Your warrior (code) is then loaded into

the core (VM, e.g. pmars) and has to compete with another warrior to make it

terminate itself (you usually do this by modifying their code, jump addresses

etc). You warrior fights against multiple other warriors to eventually be rated

and get a rank on the hill (if it's good enough) to push another off. Get the

first rank to become king of the hill until you're pushed off.

>Nice, how can I get started?

Learn redcode, there's the '88 standard and the '94 draft with some cool

features which is the de-facto standard. It's reference implementation is

pmars. Here's a beginners guide to '94: http://vyznev.net/corewar/guide.html

Here's a reference: http://www.koth.org/info/pmars-redcode-94.txt For some

advanced reading try http://www.infionline.net/~wtnewton/corewar/chapter1.html

and http://www.infionline.net/~wtnewton/corewar/chapter2.html or

http://www.corewars.org/docs/tips.html You can test your warriors in pmars

>pMARS

pMARS is the reference implementation of the '94 draft, you can get it on http://www.koth.org/pmars/ It's libre and comes for all major operating systems, most have it in their package manager, or you can compile the source yourself. You can use it to have warriors fight each other (usually you do multiple battles with randomized starting positions in the core). If you call it with the -k option it compiles your warriors into koth format (which you need to send a warrior to a hill). It also features the cbd debugger, you can either enter it during a battle or by supplying the -e option.

>cbd

use "help" to get a list of commands. "step" executes a single command and outputs the next command. Supply it with an integer to execute more than one command (e.g. "step 3" does three commands). "list" allows you to look at core addresses, "list 5" looks at the 5th command. You can also supply ranges like "list 0,100" to list a range of addresses. It also supports relative addressing (remember, all addresses are relative). Say you want to check what's at address two:


(cdb) list 2
00002 SNE.X $ -102, $ -102
(cdb)

Now where does -102 point to? Check it like this:


(cdb) list 2-102
07900
(cdb)

(i.e. we subtract 102 from 2 and end up in 8000+2-102=7900, which is empty)

You can also set traces with "trace". Use something like "trace 5" to put a trace on 5, then issue "go" to have pMARS run until just before the next execution of the command at address 5.

 No.844

>So what's a paper or bomber?

There's many strategies for corewar warriors. The most popular ones are named

stone / paper / scissor as they tend to beat each other much like in the

popular game. Check out http://corewar.co.uk/strategy.htm

>I wrote my warrior, where do I upload it?

Usually you upload your warrior by sending an email to a hill. There's several

hills with various rulesets.

Try

http://www.koth.org/koth.html

http://users.obs.carnegiescience.edu/birk/COREWAR/koenigstuhl.html

http://sal.discontinuity.info/

>What kind of hill should I choose?

Imho '88 hills are boring, no multithreading and the lack of pspace mean your

warriors are somewhat simple minded. Regular hills limit your warrior size to

100 instructions, which is a lot and easy to get lost into. For beginners I

recommend to use a smaller hill like tiny or nano. Nano limits your warrior to

5 instructions, so you have a good chance of understanding what's happening.

However that's small enough for evolvers, i.e. nano hills are usually dominated

by evolved warriors, so warriors created by hand don't stand much of a chance.

Tiny limits you to 20 instructions, there's still some evolved warriors around

but considerably less and they're not as dominant as on the nano hills. Also

this allows more elaborate warriors such as vampires. You might also be interested in the beginner hill on http://sal.discontinuity.info/hill.php?key=94b

To participate, register and then send an email with your warrior to koth@corewar.info the email has the following format:


;redcode-94b
;name my_super_warrior
;author based_anon
;strategy glory_to_8chan

ORG START
START NOP.F $ 0, $ 0
NOP.F $ 0, $ 0
NOP.F $ 0, $ 0
NOP.F $ 0, $ 0
NOP.F $ 0, $ 0
NOP.F $ 0, $ 0
JMP.B $ -6, $ 0

end

(obviously you have to replace stuff, the first line tells you which hill the warrior goes to, also remember to compile your warrior first). See http://sal.discontinuity.info/help.html for more info on the email format.

>More links

http://www.koth.org/links.html

http://users.obs.carnegiescience.edu/birk/COREWAR/

http://corewar.co.uk/guides.htm

http://www.corewar.info/beginner.htm

http://www.infionline.net/~wtnewton/corewar/

http://homepages.paradise.net.nz/~anton/cw/corewar-faq.html


 No.861

Here's a list of warriors for downloading to test yours against real world examples: http://cristal.inria.fr/~doligez/corewar/by-date/complete.htm


 No.889

>>843

This looks really cool, thank you. In your estimation how steep is the learning curve for this?


 No.890

>>889

I actually first learned redcode and then discovered the debugger. Make sure to use the debugger while learning and let your warrior fight against a NOP loop. If you know any assembly it's really easy to pick up. If you're not familiar with assembly or C then the addressing modes are a bit confusing (immediate, direct, indirect) but other than that you should be fine. Since it's only 16 or so commands and a few modifiers you can learn redcode as fast as you can read the first mentioned tut (http://vyznev.net/corewar/guide.html).

Writing capable warriors is much harder though. Getting your first warrior on a hill (other than beginner) takes a while, but once you get there you improve steadily. There's various sets of benchmarks (http://corewar.co.uk/bench.htm) to do offline testing of your warriors, I recommend optimising your warrior against one or more of those sets as well as using the debugger to see WHY your warrior looses.

There's a lot of theory and magic numbers and science involved, I doubt there's a maximum as far as skill goes. Check http://corewar.co.uk/cwmath.txt for some advanced maths. As mentioned earlier nano hills are dominated by evolved warriors, i.e. warriors written by other software. Therefore your redcode skills don't matter that much if that's what you want to do (however, your computing power and skills in any other language of your choice as well as theoretical informatics does). Check out http://www.infionline.net/~wtnewton/corewar/evol/index.html for some info on evolving.




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]