Black box: Difference between revisions
Content added Content deleted
(bug correction) |
No edit summary |
||
Line 50: | Line 50: | ||
if( dx ) { |
if( dx ) { |
||
if( board[sx][sy].H ) return {r:"H", x:sx, y:sy}; |
if( board[sx][sy].H ) return {r:"H", x:sx, y:sy}; |
||
if( ( sx == 1 || sx == s ) && ( ( sy > 0 && board[sx][sy - 1].H ) || |
if( ( (sx == 1 && dx == 1) || (sx == s && dx == -1) ) && ( ( sy > 0 && board[sx][sy - 1].H ) || |
||
( sy < s && board[sx][sy + 1].H ) ) ) return {r:"R", x:sx, y:sy}; |
( sy < s && board[sx][sy + 1].H ) ) ) return {r:"R", x:sx, y:sy}; |
||
if( isValid( sx + dx ) ) { |
if( isValid( sx + dx ) ) { |
||
Line 66: | Line 66: | ||
} else { |
} else { |
||
if( board[sx][sy].H ) return {r:"H", x:sx, y:sy}; |
if( board[sx][sy].H ) return {r:"H", x:sx, y:sy}; |
||
if( ( sy == 1 || sy == s ) && ( ( sx > 0 && board[sx - 1][sy].H ) || |
if( ( (sy == 1 && dy == 1) || (sy == s && dy == -1) ) && ( ( sx > 0 && board[sx - 1][sy].H ) || |
||
( sx < s && board[sx + 1][sy].H ) ) ) return {r:"R", x:sx, y:sy}; |
( sx < s && board[sx + 1][sy].H ) ) ) return {r:"R", x:sx, y:sy}; |
||
if( isValid( sy + dy ) ) { |
if( isValid( sy + dy ) ) { |