Black box: Difference between revisions

no edit summary
(bug correction)
No edit summary
Line 50:
if( dx ) {
if( board[sx][sy].H ) return {r:"H", x:sx, y:sy};
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};
if( isValid( sx + dx ) ) {
Line 66:
} else {
if( board[sx][sy].H ) return {r:"H", x:sx, y:sy};
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};
if( isValid( sy + dy ) ) {