#오목 모듈
위와 같이 금수까지 계산해 준다.
- 돌 착수
const {Omok,PutComplete,BlackWins,WhiteWins} = require("index");
const omokGame = new Omok();
const res =a.putStone("H8") // H8에 착수
if(res instanceof PutComplete){ //정상적으로 착수 될 때
if(res instanceof BlackWins){
//흑이 승리한 경우
}
else if(res instanceof WhiteWins){
//백이 승리한 경우
}
else{
//계속 경기가 진행 될 때
}
}
console.log(a.getImage()); //이미지 가져오기
민약 올바르지 않은 위치면 InvalidPosition 객체를 받습니다
const {Omok,InvalidPosition} = require("index");
const omokGame = new Omok();
const res = omokGame.putStone("H22") // H22는 존재하지 않음
if(res instanceof InvalidPosition){
console.log("올바르지 않은 좌표입니다");
}
이미 돌이 있으면 Occupied 객체를 받습니다
const {Omok,Occupied} = require("index");
const omokGame = new Omok();
const res = omokGame.putStone("H22") // H22는 존재하지 않음
if(res instanceof Occupied){
console.log("올바르지 않은 좌표입니다");
}
작성중.....