![]() | ![]() |
![]() | ![]() |
public int fact(int n){ if (n<=1) return 1; else return n * fact(n-1); }
################# # # # # # # # ################## # # # # # # # # # # # ####### # ########## # ### # # # # #################### # # ##### # # # # # # # # # # # # # # # # # # # # ################ ############### # ####### # ##########$y
public void solve(int x, int y){ if (board[x][y]==wall || board[x][y]==visited || solved){ return; } if (board[x][y]==exit){ System.out.println(this); solved = true; } System.out.println(this); board[x][y]=me; solve(x+1,y); solve(x-1,y); solve(x,y+1); solve(x,y-1); if (!solved){ board[x][y]=visited; } }