Changes

Jump to navigation Jump to search
Line 48: Line 48:  
         row = turtle[1] + CIRCLE[c][i][1]
 
         row = turtle[1] + CIRCLE[c][i][1]
 
         if not self._dots[self._grid_to_dot((col, row))].type:
 
         if not self._dots[self._grid_to_dot((col, row))].type:
 +
            return [col, row]
 +
    return turtle
 +
</pre>
 +
 +
In this version, the turtle orientation is set as well.
 +
 +
<pre>
 +
def _turtle_strategy(self, turtle):
 +
    c = turtle[1] % 2
 +
    for i in range(6):
 +
        col = turtle[0] + CIRCLE[c][i][0]
 +
        row = turtle[1] + CIRCLE[c][i][1]
 +
        if not self._dots[self._grid_to_dot((col, row))].type:
 +
            self._orientation = i
 
             return [col, row]
 
             return [col, row]
 
     return turtle
 
     return turtle
Line 62: Line 76:  
         row = turtle[1] + CIRCLE[c][(i + n) % 6][1]
 
         row = turtle[1] + CIRCLE[c][(i + n) % 6][1]
 
         if not self._dots[self._grid_to_dot((col, row))].type:
 
         if not self._dots[self._grid_to_dot((col, row))].type:
 +
            self._orientation = (i + n) % 6
 
             return [col, row]
 
             return [col, row]
 
     return turtle
 
     return turtle
Line 75: Line 90:  
         row = turtle[1] + CIRCLE[c][i][1]
 
         row = turtle[1] + CIRCLE[c][i][1]
 
         if self._dots[self._grid_to_dot((col, row))].type is None:
 
         if self._dots[self._grid_to_dot((col, row))].type is None:
 +
            self._orientation = i
 
             return [col, row]
 
             return [col, row]
   Line 82: Line 98:  
         row = turtle[1] + CIRCLE[c][(i + n) % 6][1]
 
         row = turtle[1] + CIRCLE[c][(i + n) % 6][1]
 
         if not self._dots[self._grid_to_dot((col, row))].type:
 
         if not self._dots[self._grid_to_dot((col, row))].type:
 +
            self._orientation = (i + n) % 6
 
             return [col, row]
 
             return [col, row]
 
     return turtle
 
     return turtle

Navigation menu