in reply to Perl meets CoreWars

This is pretty cool, but it doesn't seem to be very fair. Most of the times I tried running it, only one class of warrior (usually whichever on is listed last on the commandline) is ever getting to take turns -- even though the launcher says they're all loaded).

At one point, the launcher decided the game was over before any warrior had taken a turn.

A couple of random suggestions:

Anyway, here's my first attempt at a warrior...

;predecl # hoss1 # if the ratio of enemies warriors to the total num # of warriors is greater # then N, then attack. Otherwise, Spawn. my $ratio = 2 / 3; ;main # Check other warriors my $enemies = JProcRoutines::FindEnemyWarriors; my $all = JProcRoutines::FindWarriors; my $magic_num = (keys %$enemies) / (keys %$all); print "$me : ratio is $magic_num\n"; if ($magic_num > $ratio) { # Pick a random enemy to hit my $rand_enemy = (keys %$enemies)[rand(keys %$enemies)]; # Hit them. &JProcRoutines::Hit($rand_enemy); } else { # Replicate, and if we get an undef back, set up a wait &JProcRoutines::Replicate; }

Replies are listed 'Best First'.
Re: Re: Perl meets CoreWars
by JPaul (Hermit) on Jan 28, 2002 at 21:00 UTC
    Greetings,
    I'm terribly embaressed - I always found it extremely irritating when developers would push something out the door without testing it one last time - and what did I do? Oh the shame.

    However:

    • I can't replicate your problem with only one warrior playing on - no matter which order I put the warriors in, warrior3 always kicks butt - not that I'm entirely sure why, but it appears to Replicate more (I'll investigate, if anyone should know, it should be me). There is always all the warriors specified playing (for me).
    • The bizarre complaints about things not being in a section is fixed. Doofus to me.
    • The even stranger one when the server decides the game is over - yet everyone else plays on regardless is also fixed. Another doofus for me.
    • In theory the warriors should all start around one second of each other (which, admittedly, in clock speed is a LONG time, but) as they all have to wait for the server to come up.
    • FindBrotherWarriors() implemented
    • I'll think a bit more about making the section thing nicer, you're right - it is a bit cac-handed.

    JProcWars v0.2.1 released ;)

    JP,
    -- Alexander Widdlemouse undid his bellybutton and his bum dropped off --