Python 3 Part III: Move Starman Down (15 points) Write a function move.down that
ID: 3596772 • Letter: P
Question
Python 3
Part III: Move Starman Down (15 points) Write a function move.down that takes one argument, board, which represents the current state of the game board. Your function should move Starman down by one row, update the game board (if needed), and then return Starman's new location as [row number, column number]. Please note that these are the real row and column numbers, not the indexes in the board list. Special rules apply: please check General Tasks for Parts II through V above. Examples board! = [ [ , . board2-['.', ' .','.', 'F', '.'], CSE 101 Fall 2017 Homework #3 Page 5Explanation / Answer
def move_down(board):
for i in range(len(board)):
for j in range(len(board[i])):
if board[i][j] == '*':
if i+1 < len(board) and board[i+1][j] != 'W':
board[i+1][j] = '*'
board[i][j] = '.'
return [i, j+1]
return [-1, -1]
return [-1, -1]
# copy pastable link: https://paste.ee/p/Uvka9
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.