오늘은 엔퀸즈에 대해서 사투를 하고 있다.
element.attributes
https://developer.mozilla.org/ko/docs/Web/API/Element/attributes
주어진 요소의 속성 모음(collection)을 반환합니다.
let board=
[
[1,0,0,0],
[0,1,0,0],
[0,0,1,0],
[0,0,0,0]
]
BackSlash (\) -
go from top-left to bottom-right
--------------------------------------------------------------
주어진 역 슬래시 대각선(\)에 충돌하는 말이 있는지 확인합니다.
function hasBackSlashConflictAt (BackSlashColumnIndexAtFirstRow) {
const board = this.rows();
console.log(board);
let rowIdx;
let colIdx = BackSlashColumnIndexAtFirstRow;
let result = false;
let count = 0;
for (let rowIdx = 0; rowIdx < board.length; rowIdx++) {
for (let colIdx; colIdx < board[rowIdx].length; colIdx++) {
if (board[rowIdx][colIdx] === 1) {
count++;
}
if (count >= 2) {
result = true;
return result;
}
}
}
return result;
}