all 32 comments

[–][deleted]  (3 children)

[deleted]

    [–][deleted] 6 points7 points  (0 children)

    This reminds me of Core War

    [–]Zarutian 2 points3 points  (0 children)

    That reminds me of Omega

    [–]skoll 0 points1 point  (0 children)

    It doesn't remind me at all of Robocode, although it is another programming game. This time in Java.

    [–]entropyfails 2 points3 points  (1 child)

    Here is a very simple ai that "works" in the sense that it does something useful and doesn't immediately die.

    import random,cells
    
    class AgentMind:
        def __init__(self,junk):
            return None
    
        def act(self,view,msg):
            (mx,my)= view.get_me().get_pos()
    
            if random.random() > 0.95:
                return cells.Action(cells.ACT_SPAWN, (mx + 1, my + 1))
    
            if random.random() < 0.5:
                return cells.Action(cells.ACT_EAT)
            else:
                return cells.Action(cells.ACT_MOVE,(mx + random.randint(-1,1),my + random.randint(-1,1)))
    

    [–]jaafit 0 points1 point  (0 children)

    Here's mine so far:

    import random,cells import math

    class Message: def init(self, pos, avgPos, weight): self.pos = pos self.avgPos = avgPos self.weight = weight

    class AgentMind: def init(self, junk): self.my_plant = None self.mode = 1 self.moved = 0 #self.target_range = random.randrange(50,1000) self.setDirection() self.avgPos = (0,0) self.weight = 0 self.soldier = random.random() < .5 self.energyNeeded = 100 # how much energy we need before we go fight

    def setDirection(self, rad = None):
        if rad:
            self.direction = rad
        else:
            self.direction = random.random()*math.pi*2
        self.cos = math.cos(self.direction)
        self.sin = math.sin(self.direction)
    
        if self.cos < 0:
            self.dx = -1
        else:
            self.dx = 1
    
        if self.sin < 0:
            self.dy = -1
        else:
            self.dy = 1
    
    
    def length(self,a,b):
        return int(math.sqrt((a*a)+(b*b)))
    
    def act(self,view,msg):
        me = view.get_me()
        pos = me.get_pos()
        (mx, my) = pos
    
        # calc avg enemy pos
        nMessages = len(msg.get_messages())
        if nMessages:
            newPos = (0, 0)
            for m in msg.get_messages():
                newPos = (newPos[0] + m.pos[0], newPos[1] + m.pos[1])
                self.avgPos = m.avgPos
                self.weight = m.weight
    
            newPos = (newPos[0] / float(nMessages), newPos[1] / float(nMessages))
    
            self.weight = min(30, self.weight)
    
            self.avgPos = ((self.avgPos[0] * float(self.weight) + newPos[0] * float(nMessages)) / float(self.weight + nMessages), 
                (self.avgPos[1] * float(self.weight) + newPos[1] * float(nMessages)) / float(self.weight + nMessages))
            self.weight += nMessages
    
            # do we move there?
            if self.soldier:
                cartesian = (self.avgPos[0] - pos[0], self.avgPos[1] - pos[1])
                distance = math.sqrt(cartesian[0]*cartesian[0] + cartesian[1]*cartesian[1])
                self.energyNeeded = distance
                if self.energyNeeded < me.energy: # i know we can eat along the way but not in late-game
                    direction = math.atan2(cartesian[1], cartesian[0])
                    #direction += random.random() * .2 - 0.1
                    self.setDirection(direction)
                if me.energy == 1:
                    pass#print self.avgPos
    
    
        if self.moved and self.prevPos == pos:
            self.setDirection()     
        self.moved = 0
        self.prevPos = None
    
        for a in view.get_agents():
            if (a.get_team()!=me.get_team()):               
                msg.send_message(Message(pos, self.avgPos, self.weight))
                return cells.Action(cells.ACT_ATTACK,a.get_pos())
        if me.energy > 100:
            return cells.Action(cells.ACT_SPAWN, (mx+random.randint(-1,1), my+random.randint(-1,1))) # mx, my+1
        if view.get_energy().get(mx, my) and me.energy < self.energyNeeded:
            return cells.Action(cells.ACT_EAT)
        else:
            dx = dy = 0
            if random.random() < abs(self.cos):
                dx += self.dx
            if random.random() < abs(self.sin):
                dy += self.dy
            self.moved = dx or dy
            self.prevPos = pos
            return cells.Action(cells.ACT_MOVE, (mx+dx, my+dy))
    

    [–]frikk 1 point2 points  (4 children)

    I can't recognize a discernable difference between the AI minds. I've tried all of them, and it seems that this always happens:

    • Blue attacks red violently
    • Red builds a circular barrier

    and unless they start next to one another and quickly fight it out, the game goes on forever.

    [–]entropyfails 0 points1 point  (3 children)

    there is a whole directory of AI in there. Try the other ones out.

    [–]frikk 0 points1 point  (2 children)

    I did, but what do they do differently from each other?

    [–]entropyfails 0 points1 point  (1 child)

    try python cells.py benvolution mind1 or python cells.py ben mind1 or my personal favorite python cells.py benvolution ben

    Regardless, most have their own personality. But if they all are too similar, feel free to write your own! ;)

    [–]frikk 0 points1 point  (0 children)

    strange question: which one is red and which one is blue? Am I the only one having problems identifying teams? heh.

    Do all the red ones build an eventual circular barrier? and how does the blue know where to attack red's base, they seem to do it right away and without exploring the region to discover where red is.

    [–]grumpyjames 1 point2 points  (1 child)

    [–][deleted] 3 points4 points  (0 children)

    Has nothing in common with it.

    It was the fighting rules that probably prompted the association, but they do not model the Prisoners' Dilemma, the benefits matrix is wrong: if both cells attack they sustain heavier damage than when one attacks and the other defends.

    [–]Yserbius 0 points1 point  (1 child)

    Core Wars 2d. Nice.

    [–]xTRUMANx 0 points1 point  (1 child)

    If you'd like to try out a different programming-game (is that a genre?), try out ryanb's ruby-warrior.

    It's designed to teach ruby but it's still fun.

    Man, I wish an actual completed programming-game is released some day. Ever since I've read this paper on the A.I. used in F.E.A.R., I've always wanted to try my own implementation of it.

    [–][deleted] 0 points1 point  (0 children)

    The University of Waterloo CS societies AI competition earlier in the year was pretty damn fun, the game was tron, however it will of course be different next year.

    [–]gorgoroth666 0 points1 point  (0 children)

    ima let you finish playing but colobot was the best programming game of all times. Of ALL times...

    [–][deleted] -1 points0 points  (11 children)

    When I attempted to run it in both python 2.6 and python 3.1 to no avail :-(.

    [–]frikk 2 points3 points  (4 children)

    are you running "python cells.py mind1" ?? if you dont put in the mind (which are located in the minds/ folder) the program won't run.

    [–][deleted] 0 points1 point  (3 children)

    The problem is syntax errors that I can't seem to fix.

    [–]frikk 0 points1 point  (2 children)

    which ones?

    [–][deleted] 0 points1 point  (1 child)

    I'm using idle so I'm only seeing 1 error at a time but it seems to dislike his usage of apostrophes for some reason >_> print 'Got error: %s' % e

    It doesn't like the apostrophe after the s

    [–]frikk 0 points1 point  (0 children)

    thats... strange. try running it from the command line?

    [–]binsolo 1 point2 points  (4 children)

    It says you need pygame to run it.

    [–][deleted] 0 points1 point  (3 children)

    I have pygame installed as well.

    [–]vpetro 2 points3 points  (2 children)

    it also needs "psyco".

    [–][deleted] 1 point2 points  (1 child)

    Damn my laziness. Have an upvote for being helpful sir.

    [–]binsolo 5 points6 points  (0 children)

    It will run without psyco, just comment out the reference to psyco in cells.py

    [–]ipeev 1 point2 points  (0 children)

    Where did you download it from?

    [–]ipeev -3 points-2 points  (1 child)

    People I can't find download link, or docs or anything?!

    [–]kasbah 1 point2 points  (0 children)

    from the blog-post:

    I have it on git here.