Skip to content

Commit

Permalink
Add setStoneByForce, clearStoneByFoce
Browse files Browse the repository at this point in the history
  • Loading branch information
saroro1 committed Jul 15, 2022
1 parent 81ef495 commit cb1521a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Omok/OmokMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,32 @@
* @return {number}
*/
"getPeriod" : ()=>turn,
/**
* 돌을 강제로 배치합니다(오프닝 룰)
* b는 흑 w는 백
* @param {string}cord
* @param {"b", "w"}stone
*/
"setStoneByForce" : (cord,stone) =>{
const j = CODE.indexOf(cord[0]);
const i = +cord.slice(1)-1;
if(stone === "b"){
setStone(j,i,BLACKSTONE);
}
else if(stone === "w"){
setStone(j,i,WHITESTONE);
}
},
/**
* 돌을 강제로 지웁니다(오프닝 룰)
* b는 흑 w는 백
* @param {string}cord
*/
"clearStoneByForce" : (cord)=>{
const j = CODE.indexOf(cord[0]);
const i = +cord.slice(1)-1;
setStone(j,i,EMPTYSTONE);
}
}
}
module.exports = {
Expand Down

0 comments on commit cb1521a

Please sign in to comment.