Changes

Jump to navigation Jump to search
Line 24: Line 24:     
The default strategy is simple: choose a random direction and go there if the dot is open.
 
The default strategy is simple: choose a random direction and go there if the dot is open.
 +
 
<pre>
 
<pre>
 
def _turtle_strategy(self, turtle):
 
def _turtle_strategy(self, turtle):
Line 57: Line 58:  
The dots are stored in a 13x13 array. Each dot has an attribute, 'type', that determines it status. The edges have a type=None. Occupied dots have a type=True. Unoccupied dots have a type=False.
 
The dots are stored in a 13x13 array. Each dot has an attribute, 'type', that determines it status. The edges have a type=None. Occupied dots have a type=True. Unoccupied dots have a type=False.
    +
Your strategy should start with:
 +
 +
def _turtle_strategy(self, turtle):
 +
 +
The turtle argument is a tuple containing the column and row of the current turtle position.
 +
 +
Your strategy should return a tuple containing the column and row of the new turtle position, e.g.,
 +
 +
return [col, row]
 +
 +
There are some resources that you can use in your program, including:
 +
 +
;CIRCLE: an array of offsets that can used to find the col and row of the dots surrounding the turtle.
 +
;self._dots: the array of dots.
 +
;self._pressed: the index of the most recent dot pressed by the user
    
=== Where to get Turtle in a Pond ===
 
=== Where to get Turtle in a Pond ===

Navigation menu