if iswall(mapobjxy)return true elif len(mapobjor len(mapobj[ ])return true and aren' actually on the map elif (xyin gamestateobj['stars']return true star is blocking return false there are three cases where space on the map would be blockedif there is stara wallor the coordinates of the space are past the edges of the map the isblocked(function checks for these three cases and returns true if the xy coordinates are blocked and false if not def makemove(mapobjgamestateobjplayermoveto) """given map and game state objectsee if it is possible for the player to make the given move if it isthen change the player' position (and the position of any pushed starif notdo nothing returns true if the player movedotherwise false "" make sure the player can move in the direction they want playerxplayery gamestateobj['player' this variable is "syntactic sugartyping "starsis more readable than typing "gamestateobj['stars']in our code stars gamestateobj['stars' the code for handling each of the directions is so similar aside from adding or subtracting to the / coordinates we can simplify it by using the xoffset and yoffset variables if playermoveto =up xoffset yoffset - elif playermoveto =right xoffset yoffset elif playermoveto =down xoffset yoffset elif playermoveto =left xoffset - yoffset email questions to the authoral@inventwithpython com