I need the pseudocode of the following program: import pygame, sys from pygame·l
ID: 3854685 • Letter: I
Question
I need the pseudocode of the following program:
import pygame, sys from pygame·locals import * import numpy as np def inRangeAndEmpty(posx,posy,board,N): return (posx = 0 and posy = 0 and board [pos [posy]-0) def getAccessibility(x,y,moves,board,N): accessibility -0 for i in range(8): if inRangeAndEmpty(x+moves i][Ø],y+moves [i][1],board,N): accessibility 1 return accessibility def getNextMoves (move,moves,board,N): positionx move [0] positionymove [1] accessibility-8 fori in range(8): newx - positionx + moves [i][0] newypositiony + moves [i][1] newacc = getAccessibility(newx , newy , moves , board , N) if inRangeAndEmpty(newx, newy, board,N) and newaccExplanation / Answer
Step 1: If all blocks are visited then print solution
Step 2:Else:
i)add next move to solution and check if belongs to solution or not.It has 8 moves and select any one
ii)If above selected move does not belong solution,then remove it from solution and try another moves
iii)if none solution works then retun false
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.