Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://kodomo.cmm.msu.ru/trac/snake/changeset/10d32d7755ffb8153f6fee948d016ab2420636f7
Äàòà èçìåíåíèÿ: Unknown
Äàòà èíäåêñèðîâàíèÿ: Mon Apr 11 00:44:09 2016
Êîäèðîâêà: IBM-866
Changeset 116:10d32d7755ff òÀÓ Python Battle

Changeset 116:10d32d7755ff


Ignore:
Timestamp:
12/20/10 14:32:28 (5 years ago)
Author:
Daniil Alexeyevsky <me.dendik@òÀæ>
Branch:
default
Parents:
114:793011c1119e (diff), 115:4cafedd51b69 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Automated merge with òÀËssh://kodomo/snake

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • snake.py

    r112 r116 ˆà
    117117        char = char.lower()ˆà
    118118        assert char in self.codes, "Illegal symbol in rule: %s" % charˆà
    119ˆà        cell = engine.Cell(x, y, self.snake)ˆà
    ˆà119        cell = engine.Cell(x, y)ˆà
    ˆà120        cell.snake = self.snakeˆà
    120121        if char in 'htb':ˆà
    121122            if is_my:ˆà
    òÀæ òÀæ ˆà
    132133    def applies (self, field, x, y):ˆà
    133134        """True if the rule applies in the field at position (x,y)."""ˆà
    ˆà135        wall = engine.Cell(-1, -1)ˆà
    ˆà136        wall.type = 'void'ˆà
    ˆà137ˆà
    134138        for px, fx in zip(range(7), range(x - 3, x + 4)):ˆà
    135139            for py, fy in zip(range(7), range(y - 3, y + 4)):ˆà
    136ˆà                if (fx, fy) in field:ˆà
    137ˆà                    if field[fx, fy] != self.pattern[px, py]:ˆà
    138ˆà                        return Falseˆà
    139ˆà                else:ˆà
    140ˆà                    if self.pattern[px, py].type != 'any':ˆà
    141ˆà                        return Falseˆà
    ˆà140                if field.get((fx, fy), wall) != self.pattern[px, py]:ˆà
    ˆà141                    return Falseˆà
    142142        return Trueˆà
    143143ˆà
  • snake.py

    • Property exe set to *
    r115 r116 ˆà
    6666        for cell in self.cells:ˆà
    6767            cell.snake = selfˆà
    ˆà68        for cell in self.cells:ˆà
    ˆà69            cell.type = 'body'ˆà
    6870        self.cells[0].type = 'head'ˆà
    69ˆà        for cell in self.cells[1:-1]:ˆà
    70ˆà            cell.type = 'body'ˆà
    7171        self.cells[-1].type = 'tail'ˆà
    7272        returnˆà
Note: See TracChangeset for help on using the changeset viewer.