Knight's tour: Difference between revisions

Line 4,269:
if (nmove(n) .eq. 9) then
n = n - 1
call unmoveif (board,n imove,.ne. jmove,0) nmove, n)then
nmove call unmove (n)board, =imove, jmove, nmove(, n) + 1
nmove(n) = nmove(n) + 1
jmoveend = jif
else if (goodmv (imove, nmove, n)) then
call mkmove (board, imove, jmove, nmove, n)
Line 4,588 ⟶ 4,590:
 
if (w .eq. 0) then
call disabl (imove(1, n1), = -jmove(1, n1))
jmovecall disabl (1imove(2, n1), =jmove(2, -1n1))
call disabl (imove(43, n1), =jmove(3, -1n1))
 
call disabl (imove(24, n1), =jmove(4, -1n1))
jmovecall disabl (2imove(5, n1), =jmove(5, -1n1))
call disabl (imove(6, n1), =jmove(6, -1n1))
 
call disabl (imove(37, n1), =jmove(7, -1n1))
jmovecall disabl (3imove(8, n1), =jmove(8, -1n1))
 
imove(4,n1) = -1
jmove(4,n1) = -1
 
imove(5,n1) = -1
jmove(5,n1) = -1
 
imove(6,n1) = -1
jmove(6,n1) = -1
 
imove(7,n1) = -1
jmove(7,n1) = -1
 
imove(8,n1) = -1
jmove(8,n1) = -1
else
if (w .ne. w1) call disabl (imove(1, n1), = -jmove(1, n1))
if (w .ne. w1w2) jmovecall disabl (1imove(2, n1), =jmove(2, -1n1))
if (w .ne. w4w3) call disabl (imove(43, n1), =jmove(3, -1n1))
 
if (w .ne. w2w4) call disabl (imove(24, n1), =jmove(4, -1n1))
if (w .ne. w2w5) jmovecall disabl (2imove(5, n1), =jmove(5, -1n1))
if (w .ne. w6) call disabl (imove(6, n1), =jmove(6, -1n1))
 
if (w .ne. w3w7) call disabl (imove(37, n1), =jmove(7, -1n1))
if (w .ne. w3w8) jmovecall disabl (3imove(8, n1), =jmove(8, -1n1))
 
if (w .ne. w4) imove(4,n1) = -1
if (w .ne. w4) jmove(4,n1) = -1
 
if (w .ne. w5) imove(5,n1) = -1
if (w .ne. w5) jmove(5,n1) = -1
 
if (w .ne. w6) imove(6,n1) = -1
if (w .ne. w6) jmove(6,n1) = -1
 
if (w .ne. w7) imove(7,n1) = -1
if (w .ne. w7) jmove(7,n1) = -1
 
if (w .ne. w8) imove(8,n1) = -1
if (w .ne. w8) jmove(8,n1) = -1
end if
 
Line 4,766 ⟶ 4,738:
integer imove, jmove
 
imovecall =disabl (imove, -1jmove)
jmove = -1
if (1 .le. i .and. i .le. 8 .and. 1 .le. j .and. j .le. 8) then
if (board(i,j) .eq. -1) then
imovecall =enable (i, j, imove, jmove)
jmove = j
end if
end if
 
end
 
C-----------------------------------------------------------------------
 
subroutine enable (i, j, imove, jmove)
implicit none
 
C Enable a potential move.
 
jmoveinteger =i, -1j
integer imove(8,n1) = -1jmove
 
imove(7,n1) = -1i
jmove(5,n1) = -1j
 
end
 
C-----------------------------------------------------------------------
 
subroutine disabl (imove, jmove)
implicit none
 
C Disable a potential move.
 
integer imove, jmove
 
imove(5,n1) = -1
jmove(4,n1) = -1
 
end
1,448

edits