| 85 | |
| 86 | |
| 87 | class Stick(turtle.Turtle): |
| 88 | def __init__(self, row, col, game): |
| 89 | turtle.Turtle.__init__(self, visible=False) |
| 90 | self.row = row |
| 91 | self.col = col |
| 92 | self.game = game |
| 93 | x, y = self.coords(row, col) |
| 94 | self.shape("square") |
| 95 | self.shapesize(HUNIT/10.0, WUNIT/20.0) |
| 96 | self.speed(0) |
| 97 | self.pu() |
| 98 | self.goto(x,y) |
| 99 | self.color("white") |
| 100 | self.showturtle() |
| 101 | |
| 102 | def coords(self, row, col): |
| 103 | packet, remainder = divmod(col, 5) |
| 104 | x = (3 + 11 * packet + 2 * remainder) * WUNIT |
| 105 | y = (2 + 3 * row) * HUNIT |
| 106 | return x - SCREENWIDTH // 2 + WUNIT // 2, SCREENHEIGHT // 2 - y - HUNIT // 2 |
| 107 | |
| 108 | def makemove(self, x, y): |
| 109 | if self.game.state != Nim.RUNNING: |
| 110 | return |
| 111 | self.game.controller.notify_move(self.row, self.col) |
| 112 | |
| 113 | |
| 114 | class NimView(object): |
no outgoing calls
no test coverage detected
searching dependent graphs…