Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're testing for equality, but not doing anything with it, with those <code>==</code>. What you need is something like:</p> <pre><code>def ant_coordinates(ant_row, ant_col, orientation): color = orig_grid[ant_row][ant_col] if color == 'white': if orientation == 'East': ant_row += 1 elif orientation == 'South': ant_col -= 1 return ant_row, ant_col, orientation </code></pre> <p>I'm not sure what the actual behavior of this function is supposed to be, but what it will do is:</p> <p>If color is not white, just return all of the parameters unchanged.</p> <p>If color is white and orientation is east, return all of the parameters with row += 1. </p> <p>If color is white and orientation is south, return all of the parameters with col -= 1. </p> <p>If color is white and orientation is other, return all parameters unchanged. You can obviously extend this function to add functionality for other directions.</p> <p>What your code does now is:</p> <pre><code>def ant_coordinates(ant_row, ant_col, orientation): color = orig_grid[ant_row][ant_col] if color == 'white': # goes in here if color is white orientation == 'East' # returns True or False, value not used anywhere ant_row += 1 # always increments row if color is white orientation == 'South' # returns True or False, value not used anywhere ant_col -= 1 # always decrements col if color is white return ant_row, ant_col, orientation </code></pre> <p>Hope this helps! <code>==</code> is just a comparison, it doesn't imply an <code>if</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload