wiki:it:dream_of_enc:metaverse:game_logic
์ฐจ์ด
๋ฌธ์์ ์ ํํ ๋ ํ ์ฌ์ด์ ์ฐจ์ด๋ฅผ ๋ณด์ฌ์ค๋๋ค.
๋ค์ ํ | ์ด์ ํ | ||
wiki:it:dream_of_enc:metaverse:game_logic [2025/07/28 05:57] โ ๋ง๋ฆ - ๋ฐ๊นฅ ํธ์ง 127.0.0.1 | wiki:it:dream_of_enc:metaverse:game_logic [2025/07/30 06:43] (ํ์ฌ) โ ๋ฐ๊นฅ ํธ์ง 127.0.0.1 | ||
---|---|---|---|
์ค 7: | ์ค 7: | ||
๋ฐ๋ ๊ฒ์์ ํต์ฌ ๊ท์น๊ณผ ๋ก์ง์ JavaScript๋ก ๊ตฌํํ์ฌ ์ ํํ ๋ฐ๋ ๊ฒ์์ ์ ๊ณตํฉ๋๋ค. | ๋ฐ๋ ๊ฒ์์ ํต์ฌ ๊ท์น๊ณผ ๋ก์ง์ JavaScript๋ก ๊ตฌํํ์ฌ ์ ํํ ๋ฐ๋ ๊ฒ์์ ์ ๊ณตํฉ๋๋ค. | ||
+ | {{https:// | ||
===== ๐ฏ ๊ธฐ๋ณธ ๊ท์น ===== | ===== ๐ฏ ๊ธฐ๋ณธ ๊ท์น ===== | ||
- | **๋ฐ๋์ ๊ธฐ๋ณธ ๊ท์น:**ย | + | '' |
- | 1. **์ฐฉ์**: ํ๋๋ถํฐ ์์ํ์ฌ ๋ฒ๊ฐ์๊ฐ๋ฉฐ ๋์ ๋์ต๋๋ค.ย | + | * '' |
- | 2. **์์ ๋**: ๋์ ์ต์ ํ๋์ ์์ ๋๋ฅผ ๊ฐ์ ธ์ผ ํฉ๋๋ค.ย | + | * '' |
- | 3. **์ฐฉ์**: ์๋๋ฐฉ ๋์ ์์ ๋๋ฅผ ๋ชจ๋ ์์ ๋ฉด ๊ทธ ๋์ ์ ๊ฑฐํ ์ ์์ต๋๋ค.ย | + | * '' |
- | 4. **์์ถฉ**: ์์ ์ ๋์ ์์ ๋ ์์ด ๋์ ์ ์์ต๋๋ค.ย | + | * '' |
- | 5. **๊ณ๊ฐ**: ๊ฒ์ ์ข ๋ฃ ํ ์ ์๋ฅผ ๊ณ์ฐํฉ๋๋ค. | + | * '' |
- | ===== ๐๏ธ | + | ----ย |
+ | ==== 1. ๊ฒ์ ์ํ ๊ด๋ฆฌ ==== | ||
- | **๊ฒ์ ์ํ ํด๋์ค:**ย | + | ์ด ์น์
์์๋ ๋ฐ๋ |
- | < | + | ย |
+ | === 1) ์์ฑ์ (Constructor) - ๊ฒ์ ์ด๊ธฐํ ===ย | ||
+ | ์ด ์ฝ๋๋ '' | ||
+ | ย | ||
+ | < | ||
export default class BadukGameState { | export default class BadukGameState { | ||
constructor() { | constructor() { | ||
์ค 30: | ์ค 36: | ||
this.lastMove = null; | this.lastMove = null; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 2) ์ํ ์ฌ์ค์ (Resetting State) === | ||
+ | '' | ||
+ | < | ||
// ๊ฒ์ ์ํ ์ด๊ธฐํ | // ๊ฒ์ ์ํ ์ด๊ธฐํ | ||
reset() { | reset() { | ||
์ค 41: | ์ค 52: | ||
this.lastMove = null; | this.lastMove = null; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 3) ์ํ ์ง๋ ฌํ (Serialization - toJSON) === | ||
+ | '' | ||
+ | < | ||
// ํ์ฌ ์ํ๋ฅผ JSON์ผ๋ก ์ง๋ ฌํ | // ํ์ฌ ์ํ๋ฅผ JSON์ผ๋ก ์ง๋ ฌํ | ||
toJSON() { | toJSON() { | ||
์ค 54: | ์ค 70: | ||
}; | }; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 4) ์ํ ๋ณต์ (Deserialization - fromJSON) === | ||
+ | '' | ||
+ | < | ||
// JSON์์ ์ํ ๋ณต์ | // JSON์์ ์ํ ๋ณต์ | ||
fromJSON(data) { | fromJSON(data) { | ||
์ค 68: | ์ค 89: | ||
</ | </ | ||
- | ===== ๐ฎ ์ด๋ ๊ฒ์ฆ | + | ----ย |
+ | ==== 2. ์ด๋ ๊ฒ์ฆ ==== | ||
- | **์ ํจํ | + | ์ด ์น์
์์๋ ํ๋ ์ด์ด์ ์ฐฉ์๊ฐ |
- | < | + | ย |
+ | === 1) ์์ฑ์ (Constructor) ===ย | ||
+ | '' | ||
+ | ย | ||
+ | < | ||
export default class BadukMoveValidator { | export default class BadukMoveValidator { | ||
constructor(gameState) { | constructor(gameState) { | ||
this.gameState = gameState; | this.gameState = gameState; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 2) ์ ํจํ ์ด๋ ํ์ธ (isValidMove) === | ||
+ | '' | ||
+ | < | ||
// ์ด๋์ด ์ ํจํ์ง ํ์ธ | // ์ด๋์ด ์ ํจํ์ง ํ์ธ | ||
isValidMove(x, | isValidMove(x, | ||
์ค 101: | ์ค 132: | ||
return { valid: true, reason: ' | return { valid: true, reason: ' | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 3) ๋ฐ๋ํ ๋ฒ์ ํ์ธ (isInBounds) === | ||
+ | ์ด ๊ฐ๋จํ ์ ํธ๋ฆฌํฐ ๋ฉ์๋๋ ์ฃผ์ด์ง ์ขํ '' | ||
+ | < | ||
// ๋ฐ๋ํ ๋ฒ์ ํ์ธ | // ๋ฐ๋ํ ๋ฒ์ ํ์ธ | ||
isInBounds(x, | isInBounds(x, | ||
return x >= 0 && x < 19 && y >= 0 && y < 19; | return x >= 0 && x < 19 && y >= 0 && y < 19; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 4) ์์ถฉ ํ์ธ (isSuicide) === | ||
+ | ์์ถฉ์ ๋ฐ๋์์ ์์ ์ ๋์ ๋์์ ๋ ๊ทธ ๋์ด ์ฆ์ ์กํ๊ฒ ๋๋ ์๋ฅผ ์๋ฏธํฉ๋๋ค. ์ด ๋ฉ์๋๋ ์ฃผ์ด์ง ์์น์ ์์๋ก ๋์ ๋์๋ณด๊ณ , | ||
+ | < | ||
// ์์ถฉ ํ์ธ | // ์์ถฉ ํ์ธ | ||
isSuicide(x, | isSuicide(x, | ||
์ค 121: | ์ค 162: | ||
return !hasLiberties && !canCapture; | return !hasLiberties && !canCapture; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 5) ๋ ๊ทธ๋ฃน์ ์์ ๋ ํ์ธ (hasLiberties & checkGroupLiberties) === | ||
+ | ๋ฐ๋์์ ๋์ด ์ด๊ธฐ ์ํด์๋ ' | ||
+ | < | ||
// ์์ ๋ ํ์ธ | // ์์ ๋ ํ์ธ | ||
hasLiberties(x, | hasLiberties(x, | ||
์ค 158: | ์ค 204: | ||
return false; | return false; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 6) ์๋๋ฐฉ ๋ ์ก์ ์ ์๋์ง ํ์ธ (canCaptureOpponent) === | ||
+ | ์ด ๋ฉ์๋๋ ํน์ ์์น์ ๋์ ๋์์ ๋, ๊ทธ ๋ ์ฃผ๋ณ์ ์๋ ์๋๋ฐฉ ๋ ๊ทธ๋ฃน์ ์์ ๋๊ฐ ๋ชจ๋ ์ฌ๋ผ์ ธ ์ก์ ์ ์๋์ง ํ์ธํฉ๋๋ค. ์ฐฉ์ ์งํ ์๋๋ฐฉ ๋์ ์ ๊ฑฐํ๋ ๋ฐ ์ฌ์ฉ๋๋ ์ค์ํ ๋ก์ง์ ๋๋ค. | ||
+ | < | ||
// ์๋๋ฐฉ ๋์ ์ก์ ์ ์๋์ง ํ์ธ | // ์๋๋ฐฉ ๋์ ์ก์ ์ ์๋์ง ํ์ธ | ||
canCaptureOpponent(x, | canCaptureOpponent(x, | ||
์ค 179: | ์ค 230: | ||
return false; | return false; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 7) ์ฝ ๊ท์น ์๋ฐ ํ์ธ (isKoViolation) === | ||
+ | ' | ||
+ | < | ||
// ์ฝ ๊ท์น ํ์ธ | // ์ฝ ๊ท์น ํ์ธ | ||
isKoViolation(x, | isKoViolation(x, | ||
์ค 195: | ์ค 251: | ||
</ | </ | ||
- | ===== ๐ฏ ์ฐฉ์ ๋ก์ง | + | ----ย |
+ | ==== 3. ์ฐฉ์ ๋ก์ง ==== | ||
- | **์ฐฉ์ | + | ์ด ์น์
์์๋ ์ค์ ๋ก ๋ฐ๋ํ์ ๋์ ๋๊ณ , ๋์ด ์กํ์ ๋ ์ด๋ฅผ |
- | < | + | ย |
+ | === 1) ์์ฑ์ (Constructor) ===ย | ||
+ | '' | ||
+ | ย | ||
+ | < | ||
export default class BadukCaptureLogic { | export default class BadukCaptureLogic { | ||
constructor(gameState) { | constructor(gameState) { | ||
this.gameState = gameState; | this.gameState = gameState; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 2) ๋ ๋๊ธฐ ๋ฐ ์ฐฉ์ ์ฒ๋ฆฌ (placeStone) === | ||
+ | '' | ||
+ | * | ||
+ | * | ||
+ | * | ||
+ | * | ||
+ | < | ||
// ๋ ๋๊ธฐ ๋ฐ ์ฐฉ์ ์ฒ๋ฆฌ | // ๋ ๋๊ธฐ ๋ฐ ์ฐฉ์ ์ฒ๋ฆฌ | ||
placeStone(x, | placeStone(x, | ||
์ค 240: | ์ค 310: | ||
return { success: true, captured: captured }; | return { success: true, captured: captured }; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 3) ์ฐฉ์ ์คํ (processCapture) === | ||
+ | ๋์ ๋์ ํ, ์ด ๋ฉ์๋๋ ์๋ก ๋์ธ ๋ ์ฃผ๋ณ์ 4๋ฐฉํฅ์ ํ์ธํฉ๋๋ค. ๋ง์ฝ ์ธ์ ํ ์๋๋ฐฉ ๋ ๊ทธ๋ฃน์ด ์์ ๋๋ฅผ ๋ชจ๋ ์์๋ค๋ฉด, | ||
+ | < | ||
// ์ฐฉ์ ์ฒ๋ฆฌ | // ์ฐฉ์ ์ฒ๋ฆฌ | ||
processCapture(x, | processCapture(x, | ||
์ค 273: | ์ค 348: | ||
return totalCaptured; | return totalCaptured; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 4) ๋ ๊ทธ๋ฃน ์ ๊ฑฐ (removeGroup) === | ||
+ | ์ด ๋ฉ์๋๋ ์กํ ๋ ๊ทธ๋ฃน์ ํน์ ๋ '' | ||
+ | < | ||
// ๊ทธ๋ฃน ์ ๊ฑฐ | // ๊ทธ๋ฃน ์ ๊ฑฐ | ||
removeGroup(x, | removeGroup(x, | ||
์ค 303: | ์ค 383: | ||
return count; | return count; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 5) ์์ ๋ ํ์ธ ์ ํธ๋ฆฌํฐ (hasLiberties, | ||
+ | ์ด ๋ฉ์๋๋ค์ '' | ||
+ | < | ||
// ์์ ๋ ํ์ธ (BadukMoveValidator์ ๋์ผ) | // ์์ ๋ ํ์ธ (BadukMoveValidator์ ๋์ผ) | ||
hasLiberties(x, | hasLiberties(x, | ||
์ค 346: | ์ค 431: | ||
</ | </ | ||
- | ===== ๐ฏ ํจ์ค ๋ฐ ํญ๋ณต | + | ----ย |
+ | ==== 4. ํจ์ค ๋ฐ ํญ๋ณต ==== | ||
- | **ํจ์ค | + | ์ด ์น์
์์๋ ํ๋ ์ด์ด๊ฐ ๋์ ๋๋ ๋์ 'ํจ์ค' |
- | < | + | ย |
+ | === 1) ์์ฑ์ (Constructor) ===ย | ||
+ | '' | ||
+ | ย | ||
+ | < | ||
export default class BadukPassLogic { | export default class BadukPassLogic { | ||
constructor(gameState) { | constructor(gameState) { | ||
์ค 355: | ์ค 445: | ||
this.consecutivePasses = 0; | this.consecutivePasses = 0; | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 2) ํจ์ค ์ฒ๋ฆฌ (pass) === | ||
+ | ํ๋ ์ด์ด๊ฐ ' | ||
+ | < | ||
// ํจ์ค ์ฒ๋ฆฌ | // ํจ์ค ์ฒ๋ฆฌ | ||
pass(player) { | pass(player) { | ||
์ค 375: | ์ค 470: | ||
return { success: true, consecutivePasses: | return { success: true, consecutivePasses: | ||
} | } | ||
+ | </ | ||
+ | |||
+ | === 3) ํญ๋ณต ์ฒ๋ฆฌ (surrender) === | ||
+ | ํ๋ ์ด์ด๊ฐ ' | ||
+ | < | ||
// ํญ๋ณต ์ฒ๋ฆฌ | // ํญ๋ณต ์ฒ๋ฆฌ | ||
surrender(player) { | surrender(player) { | ||
์ค 392: | ์ค 492: | ||
return { success: true, winner: winner }; | return { success: true, winner: winner }; | ||
} | } | ||
+ | </ | ||
+ | --- | ||
+ | === 4) ๊ฒ์ ์ข ๋ฃ (endGame) === | ||
+ | ๋ ํ๋ ์ด์ด๊ฐ ์ฐ์์ผ๋ก ํจ์คํ๊ฑฐ๋ ํ ํ๋ ์ด์ด๊ฐ ํญ๋ณตํ์ฌ ๊ฒ์์ด ์ข
๋ฃ๋ ๋ ํธ์ถ๋ฉ๋๋ค. ๊ฒ์ ๋จ๊ณ๋ฅผ ' | ||
+ | |||
+ | < | ||
// ๊ฒ์ ์ข ๋ฃ | // ๊ฒ์ ์ข ๋ฃ | ||
endGame() { | endGame() { | ||
์ค 399: | ์ค 505: | ||
this.calculateFinalScore(); | this.calculateFinalScore(); | ||
} | } | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | === 5) ์์ญ ๊ณ์ฐ (calculateTerritory & analyzeTerritory) === | ||
+ | ๋ฐ๋ํ์ ๋น ๊ณต๊ฐ(์ง)์ ํ์ํ์ฌ ๊ฐ ์์ญ์ด ์ด๋ ํ๋ ์ด์ด์ ์์ ์ธ์ง ๊ณ์ฐํฉ๋๋ค. | ||
+ | * '' | ||
+ | * '' | ||
+ | < | ||
// ์์ญ ๊ณ์ฐ | // ์์ญ ๊ณ์ฐ | ||
calculateTerritory() { | calculateTerritory() { | ||
์ค 453: | ์ค 567: | ||
} | } | ||
} | } | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | === 6) ์์ญ ์์ ์ ๊ฒฐ์ (determineTerritoryOwner) === | ||
+ | ์ด ๋ฉ์๋๋ ํน์ ๋น ์์ญ์ ๋๋ฌ์ธ๊ณ ์๋ ๋์ ์๊น์ ๋ถ์ํ์ฌ ํด๋น ์์ญ์ ์์ ์๋ฅผ ๊ฒฐ์ ํฉ๋๋ค. ์์ญ ์ฃผ๋ณ์ ํ๋๋ง ์์ผ๋ฉด ํ์ ์์ญ์ผ๋ก, | ||
+ | < | ||
// ์์ญ ์์ ์ ๊ฒฐ์ | // ์์ญ ์์ ์ ๊ฒฐ์ | ||
determineTerritoryOwner(blackStones, | determineTerritoryOwner(blackStones, | ||
์ค 460: | ์ค 580: | ||
} else if (whiteStones > 0 && blackStones === 0) { | } else if (whiteStones > 0 && blackStones === 0) { | ||
return ' | return ' | ||
+ | } else { | ||
+ | return null; // ์์ ์ ์์ (์: ์ธํค ๋๋ ๊ณตํต ์์ญ) | ||
} | } | ||
- | return null; // ์ค๋ฆฝ ์์ญ | ||
} | } | ||
+ | </ | ||
+ | ===== ๐ฒ ๋ฐ๋ ๊ฒ์ ํต์ฌ ๊ธฐ๋ฅ ===== | ||
+ | |||
+ | ==== 1. ๊ฒ์ ์ํ ๋ฐ ์ ์ ๊ณ์ฐ ==== | ||
+ | ์ด ์น์
์์๋ ๋ฐ๋ ๊ฒ์์ ํ์ฌ ์ํ๋ฅผ ๊ด๋ฆฌํ๊ณ , | ||
+ | |||
+ | ---- | ||
+ | === 1) ์ต์ข ์ ์ ๊ณ์ฐ === | ||
+ | '' | ||
- | // ์ต์ข ์ ์ ๊ณ์ฐ | + | < |
calculateFinalScore() { | calculateFinalScore() { | ||
const blackScore = this.gameState.territory.black + this.gameState.capturedStones.black; | const blackScore = this.gameState.territory.black + this.gameState.capturedStones.black; | ||
const whiteScore = this.gameState.territory.white + this.gameState.capturedStones.white + 6.5; // ๋ฐฑ์ ๋ฐ์ง | const whiteScore = this.gameState.territory.white + this.gameState.capturedStones.white + 6.5; // ๋ฐฑ์ ๋ฐ์ง | ||
- | | + | |
this.gameState.finalScore = { | this.gameState.finalScore = { | ||
black: blackScore, | black: blackScore, | ||
์ค 475: | ์ค 605: | ||
}; | }; | ||
} | } | ||
+ | </ | ||
+ | ---- | ||
+ | === 2) ๋ณด๋ ๋ด ์์น ์ ํจ์ฑ ๊ฒ์ฌ === | ||
+ | '' | ||
+ | |||
+ | < | ||
isInBounds(x, | isInBounds(x, | ||
return x >= 0 && x < 19 && y >= 0 && y < 19; | return x >= 0 && x < 19 && y >= 0 && y < 19; | ||
} | } | ||
- | } | ||
</ | </ | ||
===== ๐ ๊ฒ์ ํต๊ณ ===== | ===== ๐ ๊ฒ์ ํต๊ณ ===== | ||
+ | ์ด ์น์ ์์๋ ๋ฐ๋ ๊ฒ์์ ๋ค์ํ ํต๊ณ๋ฅผ ๊ธฐ๋กํ๊ณ ๊ด๋ฆฌํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์ค๋ช ํฉ๋๋ค. | ||
+ | |||
+ | ==== 1. ๊ฒ์ ํต๊ณ ๊ด๋ฆฌ ํด๋์ค (BadukStatistics) ==== | ||
+ | '' | ||
- | **๊ฒ์ ํต๊ณ ๊ด๋ฆฌ:**ย | + | < |
- | < | + | |
export default class BadukStatistics { | export default class BadukStatistics { | ||
constructor() { | constructor() { | ||
์ค 499: | ์ค 637: | ||
}; | }; | ||
} | } | ||
+ | |||
// ๊ฒ์ ๊ฒฐ๊ณผ ๊ธฐ๋ก | // ๊ฒ์ ๊ฒฐ๊ณผ ๊ธฐ๋ก | ||
recordGameResult(gameState) { | recordGameResult(gameState) { | ||
this.stats.totalGames++; | this.stats.totalGames++; | ||
- | | + | |
if (gameState.surrender) { | if (gameState.surrender) { | ||
this.stats.surrenders++; | this.stats.surrenders++; | ||
์ค 513: | ์ค 651: | ||
} | } | ||
} | } | ||
- | | + | |
// ํ๊ท ๊ฒ์ ๊ธธ์ด ์ ๋ฐ์ดํธ | // ํ๊ท ๊ฒ์ ๊ธธ์ด ์ ๋ฐ์ดํธ | ||
const gameLength = gameState.moveHistory.length; | const gameLength = gameState.moveHistory.length; | ||
this.stats.averageGameLength = | this.stats.averageGameLength = | ||
(this.stats.averageGameLength * (this.stats.totalGames - 1) + gameLength) / this.stats.totalGames; | (this.stats.averageGameLength * (this.stats.totalGames - 1) + gameLength) / this.stats.totalGames; | ||
- | | + | |
// ์ด ์ด๋ ์ ์ ๋ฐ์ดํธ | // ์ด ์ด๋ ์ ์ ๋ฐ์ดํธ | ||
this.stats.totalMoves += gameLength; | this.stats.totalMoves += gameLength; | ||
- | | + | |
// ์ฐฉ์ ํต๊ณ ์ ๋ฐ์ดํธ | // ์ฐฉ์ ํต๊ณ ์ ๋ฐ์ดํธ | ||
this.stats.captures.black += gameState.capturedStones.black; | this.stats.captures.black += gameState.capturedStones.black; | ||
this.stats.captures.white += gameState.capturedStones.white; | this.stats.captures.white += gameState.capturedStones.white; | ||
- | | + | |
// ํจ์ค ํต๊ณ ์ ๋ฐ์ดํธ | // ํจ์ค ํต๊ณ ์ ๋ฐ์ดํธ | ||
const passCount = gameState.moveHistory.filter(move => move.type === ' | const passCount = gameState.moveHistory.filter(move => move.type === ' | ||
this.stats.passes += passCount; | this.stats.passes += passCount; | ||
} | } | ||
+ | |||
// ํต๊ณ ๊ฐ์ ธ์ค๊ธฐ | // ํต๊ณ ๊ฐ์ ธ์ค๊ธฐ | ||
getStats() { | getStats() { | ||
์ค 547: | ์ค 685: | ||
// ํต๊ณ ์ด๊ธฐํ | // ํต๊ณ ์ด๊ธฐํ | ||
- | | + | |
this.stats = { | this.stats = { | ||
totalGames: 0, | totalGames: 0, | ||
์ค 558: | ์ค 696: | ||
surrenders: 0 | surrenders: 0 | ||
}; | }; | ||
+ | } | ||
+ | |||
+ | // ํต๊ณ ์ถ๋ ฅ (์์) | ||
+ | displayStats() { | ||
+ | const currentStats = this.getStats(); | ||
+ | console.log(" | ||
+ | console.log(`์ด ๊ฒ์ ์: ${currentStats.totalGames}`); | ||
+ | console.log(`ํ ์น๋ฆฌ: ${currentStats.blackWins} (${currentStats.winRate.black}%)`); | ||
+ | console.log(`๋ฐฑ ์น๋ฆฌ: ${currentStats.whiteWins} (${currentStats.winRate.white}%)`); | ||
+ | console.log(`ํ๊ท ๊ฒ์ ๊ธธ์ด (์): ${currentStats.averageGameLength.toFixed(1)}`); | ||
+ | console.log(`์ด ์ฐฉ์ ์: ${currentStats.totalMoves}`); | ||
+ | console.log(`ํ๊ท ํ ํฌํ ์: ${currentStats.averageCaptures.black}`); | ||
+ | console.log(`ํ๊ท ๋ฐฑ ํฌํ ์: ${currentStats.averageCaptures.white}`); | ||
+ | console.log(`ํจ์ค ์: ${currentStats.passes}`); | ||
+ | console.log(`๊ธฐ๊ถ ์: ${currentStats.surrenders}`); | ||
} | } | ||
} | } | ||
</ | </ | ||
- | ===== ๐ ๊ด๋ จ ๋ฌธ์ ===== | + | ----ย |
+ | === 1) ๊ฒ์ ๊ฒฐ๊ณผ ๊ธฐ๋ก (recordGameResult) | ||
+ | '' | ||
- | * [[wiki: | + | ----ย |
- | * [[wiki: | + | === 2) ํต๊ณ ๊ฐ์ ธ์ค๊ธฐ (getStats) ===ย |
- | * [[wiki: | + | '' |
+ | ย | ||
+ | ----ย | ||
+ | === 3) ํต๊ณ ์ด๊ธฐํ (resetStats) ===ย | ||
+ | '' | ||
+ | ย | ||
+ | ----ย | ||
+ | === 4) ํต๊ณ ์ถ๋ ฅ (displayStats) ===ย | ||
+ | '' | ||
- | --- | ||
- | //์ด ํ์ด์ง๋ ์๋์ผ๋ก ์์ฑ๋์์ต๋๋ค.// |
wiki/it/dream_of_enc/metaverse/game_logic.1753682235.txt.gz ยท ๋ง์ง๋ง์ผ๋ก ์์ ๋จ: ์ ์ 127.0.0.1