๐ฒ ํ๋ฅ ์ฒดํ ์นด์ง๋ ธ - ๋ฃฐ๋ /์ฌ๋กฏ/์ฃผ์ฌ์ ์๋ฎฌ๋ ์ดํฐ
g5se-probability-casino
๋ฌธ์ ์ค๋ช
๐ฐ ํ๋ก์ ํธ ๊ฐ์
์ํ ์๊ฐ์ ๋ฐฐ์ด ํ๋ฅ ์ ์ง์ ์ฒดํํด๋ณด๋ ๋ฏธ๋ ์นด์ง๋ ธ ๊ฒ์ ๋ชจ์์ ๋๋ค. ๋ฃฐ๋ , ์ฌ๋กฏ๋จธ์ , ์ฃผ์ฌ์ ๊ฒ์์ ๋ธ๋ผ์ฐ์ ์์ ์ฆ๊ธฐ๋ฉด์ ๊ฐ ๊ฒ์์ ๋น์ฒจ ํ๋ฅ ์ ์ค์๊ฐ์ผ๋ก ํ์ธํ ์ ์์ต๋๋ค. "ํ์ด์ ์ฌ์ ์ด ๋ด ํธ์ผ๊น?" โ ์ฌ๋ฏธ์๊ฒ ๋๋ฉด์ ํ๋ฅ ์ ์ธ๊ณ๋ฅผ ํํํ์ธ์!
โจ ํต์ฌ ๊ธฐ๋ฅ
ํ์ ๊ตฌํ
- ๋ฃฐ๋ ๊ฒ์: 0~36๋ฒ ์ซ์ํ์ ๋ฐฐํ ํ ๊ณต ๋๋ฆฌ๊ธฐ. ์์(๋นจ๊ฐ/๊ฒ์ ), ํ์ง, ๊ตฌ๊ฐ ๋ฐฐํ ์ง์
- ์ฌ๋กฏ๋จธ์ : 3๊ฐ ๋ฆด ํ์ ํ ์กฐํฉ ํ์ธ. 777 ์ญํ, ๊ฐ์ ๊ทธ๋ฆผ 3๊ฐ, 2๊ฐ ์ผ์น ๋ฑ ๋ฑ๊ธ๋ณ ๋ฐฐ๋น
- ์ฃผ์ฌ์ ๊ฒ์: 2๊ฐ ์ฃผ์ฌ์ ํฉ ๋ง์ถ๊ธฐ. 7/11 ๋๋ธ ๋ณด๋์ค, ์ค๋ค์ดํฌ ์์ด์ฆ(1+1) ํน์ ๊ท์น
- ๊ฒ์๋ณ ํ๋ฅ ํ์: ๊ฐ ๋ฐฐํ ์ต์ ์ ์ด๋ก ์ ํ๋ฅ ์ ์ค์๊ฐ์ผ๋ก ๋ณด์ฌ์ฃผ๋ ์ ๋ณด ํจ๋
- ํ๋ ์ด ๊ธฐ๋ก: ์ต๊ทผ 10ํ ๊ฒ์ ๊ฒฐ๊ณผ ํ์คํ ๋ฆฌ (๋น์ฒจ ์ฌ๋ถ, ๋ฐฐ๋น๋ฅ ํฌํจ)
- ์นฉ ์์คํ : ๊ฐ์ ์นฉ 1000๊ฐ ์ง๊ธ. ๋ฐฐํ ํ ๊ฒฐ๊ณผ์ ๋ฐ๋ผ ์นฉ ์ฆ๊ฐ. ํ์ฐ ์ ๋ฆฌ์ ๋ฒํผ
๋ณด๋์ค ๊ธฐ๋ฅ
- ํต๊ณ ๋์๋ณด๋: ์ด ๊ฒ์ ์, ์น๋ฅ , ์ต๋ ์ฐ์น, ๋์ ์์ต๋ฅ ์ฐจํธ
- ๋ญํค ์คํธ๋ฆญ ์๋ฆผ: 3์ฐ์น ์ "๐ฅ ํ์ด์ ์ฐ์!" ์ ๋๋ฉ์ด์ ํจ๊ณผ
- ์ฌ์ด๋ ํจ๊ณผ: ๋ฃฐ๋ ํ์ ์, ์ฌ๋กฏ ์ ์ง์, ๋น์ฒจ ํกํ๋ (Web Audio API)
- ๋คํฌ๋ชจ๋ ํ ๊ธ: modern shell ํ ํฐ ๊ธฐ๋ฐ ์๋ ์ ํ
๐ฏ ํ์ต ๋ชฉํ
- g5se ํด๋ ๊ธฐ๋ฐ ์๋ ๋ผ์ฐํ
์ฒดํ (
app/modules/probability-casino/index.phpโ/probability-casino) - modern shell ํตํฉ์ผ๋ก ์ฌ์ดํธ ์ผ๊ด์ฑ ์ ์ง (nav/footer/๋คํฌ๋ชจ๋ ํ ๊ธ ์๋ ์ ์ฉ)
- SQLite DB ์์ด ๋ธ๋ผ์ฐ์ sessionStorage๋ก ๊ฒ์ ์ํ ๊ด๋ฆฌ (์๋ก๊ณ ์นจ ์ ์นฉ ์ ์ง)
- CSS ๋ณ์ ํ์ฉํ ๋คํฌ๋ชจ๋ ๋์ ๋์์ธ
- ์์ JavaScript๋ก ๋๋ค ๋ก์ง & ์ ๋๋ฉ์ด์ ๊ตฌํ (์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ถํ์)
๐ ๊ธฐ๋ ํจ๊ณผ
์ ๋ฌธ์๋ AI์ ํจ๊ป๋ผ๋ฉด 30๋ถ ์์ ์๋ํ๋ ๋ฏธ๋ ์นด์ง๋ ธ๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค. ํ๋ฅ ์ด๋ก ์ ๊ฒ์์ผ๋ก ์ฒดํํ๋ฉฐ ํ๋ก๊ทธ๋๋ฐ์ ์ฌ๋ฏธ๋ฅผ ๋๊ปด๋ณด์ธ์!
์ ์ฝ ์กฐ๊ฑด
- โข g5se ์ค์น๋ณธ ์์์ ์์ (https://github.com/gnuboard/g5se main ๋ธ๋์น ๊ธฐ์ค)
- โข ํด๋ ์๋ ๋ผ์ฐํ ์ฌ์ฉ: app/modules/probability-casino/index.php โ /probability-casino (๋ผ์ฐํธ ๋ฑ๋ก ๋ถํ์)
- โข modern shell ํ์ ์ ์ฉ (_head.inc.php + m-shell + _nav.inc.php + m-container + _footer.inc.php + tail.sub.php)
- โข ๋์์ธ ํ ํฐ ์ฌ์ฉ (๋ฐฐ๊ฒฝ var(--m-surface), ํ ์คํธ var(--m-text), ๊ทธ๋ฆผ์ var(--m-shadow) ๋ฑ) โ ๋คํฌ๋ชจ๋ ์๋ ๋์
- โข DB ์ฌ์ฉ ๊ธ์ง โ ๊ฒ์ ์ํ๋ ๋ธ๋ผ์ฐ์ sessionStorage๋ก ๊ด๋ฆฌ (์นฉ ์์ก, ํ๋ ์ด ํ์คํ ๋ฆฌ)
- โข ์์ PHP + HTML/CSS/JS๋ก ๊ตฌํ (Laravel/Composer/React/Vue/npm ๊ธ์ง)
- โข ์ธ๋ถ CDN ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ ๊ธ์ง โ ์์ ๋ฐ๋๋ผ JS๋ก ์ ๋๋ฉ์ด์ ๊ตฌํ
- โข ์ถ๋ ฅ ์ด์ค์ผ์ดํ ํ์ (์ฌ์ฉ์ ์ ๋ ฅ ์์ผ๋ฏ๋ก ์ฃผ๋ก ํ๋์ฝ๋ฉ๋ ํ ์คํธ)
- โข ๋ฃฐ๋ /์ฌ๋กฏ/์ฃผ์ฌ์ ๊ฐ๊ฐ ํญ ๋๋ ๋ฒํผ์ผ๋ก ์ ํ ๊ฐ๋ฅํ๊ฒ UI ๊ตฌ์ฑ
- โข ํ๋ฅ ๊ณ์ฐ ๋ก์ง์ ๋ช ํํ ์ฃผ์์ผ๋ก ์ค๋ช (๊ต์ก ๋ชฉ์ )
ํ๋กฌํํธ ๋ ์ํผ
์๋ ํ๋กฌํํธ๋ฅผ ์์๋๋ก AI์๊ฒ ๋ณด๋ด๋ฉด ๋ฉ๋๋ค. ๋ณต์ฌ ๋ฒํผ์ ๋๋ฌ ๋ฐ๋ก ์ฌ์ฉํ์ธ์.
g5se๊ฐ ์ค์น๋ ๋๋ ํฐ๋ฆฌ(๋ฃจํธ์ `index.php`, `app/` ํด๋๊ฐ ์๋ ๊ณณ)์์ ์์
์ ์์ํฉ๋๋ค. (g5se ์ค์น๋ https://github.com/gnuboard/g5se ์ฐธ๊ณ )
**1๋จ๊ณ: ํ๋ก์ ํธ ํด๋ ์์ฑ & modern shell ๊ณจ๊ฒฉ ๊ตฌ์ฑ**
์๋ ํ์ผ์ ์์ฑํด์ฃผ์ธ์:
**ํ์ผ: `app/modules/probability-casino/index.php`**
```php
<?php
include_once('./_common.php');
// ํ์ด์ง ๋ฉํ ์ ๋ณด
$g5['title'] = 'ํ๋ฅ ์ฒดํ ์นด์ง๋
ธ';
require_once(G5_THEME_PATH.'/modern/_head.inc.php');
include_once('./head.sub.php');
?>
<div class="m-shell">
<?php require G5_THEME_PATH.'/modern/_nav.inc.php'; ?>
<main class="m-container" style="padding: 32px 20px 48px;">
<div class="casino-header" style="text-align: center; margin-bottom: 40px;">
<h1 style="font-size: 2.5rem; font-weight: 700; margin-bottom: 12px;">๐ฒ ํ๋ฅ ์ฒดํ ์นด์ง๋
ธ</h1>
<p style="color: var(--m-text-muted); font-size: 1.1rem;">ํ์ด์ ์ฌ์ ์ด ๋ด ํธ์ผ๊น? ๋ฃฐ๋ ยท์ฌ๋กฏยท์ฃผ์ฌ์๋ก ํ๋ฅ ์ ์ธ๊ณ๋ฅผ ํํํ์ธ์!</p>
</div>
<!-- ์นฉ ์์ก ํ์ -->
<div class="chip-balance" style="background: var(--m-surface); padding: 20px; border-radius: var(--m-radius-lg); box-shadow: var(--m-shadow); margin-bottom: 32px; text-align: center;">
<div style="font-size: 0.9rem; color: var(--m-text-muted); margin-bottom: 8px;">๋ณด์ ์นฉ</div>
<div id="chipAmount" style="font-size: 2.5rem; font-weight: 700; color: #f59e0b;">1000</div>
<button id="resetChips" style="margin-top: 12px; padding: 8px 20px; background: #ef4444; color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600;">์นฉ ๋ฆฌ์
</button>
</div>
<!-- ๊ฒ์ ํญ -->
<div class="game-tabs" style="display: flex; gap: 12px; margin-bottom: 32px; justify-content: center;">
<button class="tab-btn active" data-game="roulette" style="padding: 12px 24px; background: var(--m-surface); border: 2px solid #3b82f6; border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--m-text); transition: all 0.2s;">๐ก ๋ฃฐ๋ </button>
<button class="tab-btn" data-game="slot" style="padding: 12px 24px; background: var(--m-surface); border: 2px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--m-text); transition: all 0.2s;">๐ฐ ์ฌ๋กฏ๋จธ์ </button>
<button class="tab-btn" data-game="dice" style="padding: 12px 24px; background: var(--m-surface); border: 2px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--m-text); transition: all 0.2s;">๐ฒ ์ฃผ์ฌ์</button>
</div>
<!-- ๊ฒ์ ์์ญ (๋ค์ ๋จ๊ณ์์ ๊ตฌํ) -->
<div id="gameArea" style="background: var(--m-surface); padding: 32px; border-radius: var(--m-radius-lg); box-shadow: var(--m-shadow); min-height: 400px;">
<p style="text-align: center; color: var(--m-text-muted);">๊ฒ์์ ์ ํํ์ธ์</p>
</div>
<!-- ํ๋ ์ด ํ์คํ ๋ฆฌ -->
<div class="play-history" style="margin-top: 32px; background: var(--m-surface); padding: 24px; border-radius: var(--m-radius-lg); box-shadow: var(--m-shadow);">
<h3 style="font-size: 1.3rem; font-weight: 700; margin-bottom: 16px;">๐ ์ต๊ทผ ํ๋ ์ด ๊ธฐ๋ก</h3>
<div id="historyList" style="color: var(--m-text-muted);">์์ง ํ๋ ์ดํ ๊ฒ์์ด ์์ต๋๋ค</div>
</div>
</main>
<?php require G5_THEME_PATH.'/modern/_footer.inc.php'; ?>
</div>
<style>
.tab-btn.active {
border-color: #3b82f6 !important;
background: rgba(59, 130, 246, 0.1) !important;
}
.tab-btn:hover {
background: rgba(59, 130, 246, 0.05) !important;
}
</style>
<script>
// sessionStorage์์ ์นฉ ๋ถ๋ฌ์ค๊ธฐ
let chips = parseInt(sessionStorage.getItem('casinoChips')) || 1000;
document.getElementById('chipAmount').textContent = chips;
// ์นฉ ๋ฆฌ์
document.getElementById('resetChips').addEventListener('click', () => {
chips = 1000;
sessionStorage.setItem('casinoChips', chips);
document.getElementById('chipAmount').textContent = chips;
alert('์นฉ์ด 1000๊ฐ๋ก ๋ฆฌ์
๋์์ต๋๋ค!');
});
// ํญ ์ ํ
const tabs = document.querySelectorAll('.tab-btn');
tabs.forEach(tab => {
tab.addEventListener('click', () => {
tabs.forEach(t => t.classList.remove('active'));
tab.classList.add('active');
const game = tab.dataset.game;
loadGame(game);
});
});
function loadGame(game) {
const area = document.getElementById('gameArea');
area.innerHTML = `<p style="text-align: center; color: var(--m-text-muted);">${game} ๊ฒ์ ๋ก๋ฉ ์ค...</p>`;
// ๋ค์ ๋จ๊ณ์์ ๊ฒ์๋ณ UI ๊ตฌํ
}
// ํ์คํ ๋ฆฌ ์ถ๊ฐ ํจ์
function addHistory(game, result, bet, win) {
const history = JSON.parse(sessionStorage.getItem('casinoHistory') || '[]');
history.unshift({ game, result, bet, win, time: new Date().toLocaleTimeString() });
if (history.length > 10) history.pop();
sessionStorage.setItem('casinoHistory', JSON.stringify(history));
renderHistory();
}
function renderHistory() {
const history = JSON.parse(sessionStorage.getItem('casinoHistory') || '[]');
const list = document.getElementById('historyList');
if (history.length === 0) {
list.innerHTML = '<p style="color: var(--m-text-muted);">์์ง ํ๋ ์ดํ ๊ฒ์์ด ์์ต๋๋ค</p>';
return;
}
list.innerHTML = history.map(h => `
<div style="padding: 12px; margin-bottom: 8px; background: rgba(59, 130, 246, 0.05); border-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<span>${h.time} | ${h.game}</span>
<span style="font-weight: 600; color: ${h.win > 0 ? '#10b981' : '#ef4444'};">${h.result} (${h.win > 0 ? '+' : ''}${h.win} ์นฉ)</span>
</div>
`).join('');
}
renderHistory();
</script>
<?php include_once('./tail.sub.php'); ?>
```
์ด ํ์ผ์ `/probability-casino` URL๋ก ์๋ ๋งคํ๋ฉ๋๋ค (ํด๋ ๊ธฐ๋ฐ ๋ผ์ฐํ
). modern shell๋ก ์ฌ์ดํธ nav/footer๊ฐ ์๋์ผ๋ก ๋ถ๊ณ , ์นฉ ์์ก๊ณผ ํ์คํ ๋ฆฌ๋ sessionStorage๋ก ๊ด๋ฆฌ๋ฉ๋๋ค.
๊ธฐ๋ ๊ฒฐ๊ณผ: ๋ธ๋ผ์ฐ์ ์์ `/probability-casino` ์ ์ ์ ์นด์ง๋ ธ ํค๋, ์นฉ ์์ก(1000), ๊ฒ์ ํญ(๋ฃฐ๋ /์ฌ๋กฏ/์ฃผ์ฌ์), ๋น ๊ฒ์ ์์ญ, ํ์คํ ๋ฆฌ ์น์ ์ด ํ์๋ฉ๋๋ค. ํญ ํด๋ฆญ ์ active ์คํ์ผ์ด ์ ํ๋๋ฉฐ '๊ฒ์ ๋ก๋ฉ ์ค...' ๋ฉ์์ง๊ฐ ๋น๋๋ค. ์นฉ ๋ฆฌ์ ๋ฒํผ ํด๋ฆญ ์ 1000์ผ๋ก ์ด๊ธฐํ๋ฉ๋๋ค. modern shell ๋๋ถ์ ์ฌ์ดํธ ์ ์ฒด nav/footer/๋คํฌ๋ชจ๋ ํ ๊ธ์ด ์๋์ผ๋ก ๋ฐ๋ผ์ต๋๋ค.
**2๋จ๊ณ: ๋ฃฐ๋ ๊ฒ์ ๊ตฌํ**
`app/modules/probability-casino/index.php`์ `loadGame()` ํจ์๋ฅผ ์๋์ฒ๋ผ ์์ ํ๊ณ , ๋ฃฐ๋ ๊ฒ์ ๋ก์ง์ ์ถ๊ฐํด์ฃผ์ธ์.
**์์ ํ ๋ถ๋ถ: `<script>` ํ๊ทธ ์์ `loadGame()` ํจ์**
```javascript
function loadGame(game) {
const area = document.getElementById('gameArea');
if (game === 'roulette') {
area.innerHTML = `
<h2 style="text-align: center; font-size: 1.8rem; font-weight: 700; margin-bottom: 24px;">๐ก ๋ฃฐ๋ ๊ฒ์</h2>
<div style="text-align: center; margin-bottom: 24px;">
<div id="rouletteWheel" style="width: 200px; height: 200px; margin: 0 auto; border-radius: 50%; background: conic-gradient(#ef4444 0deg 180deg, #1f2937 180deg 360deg); display: flex; align-items: center; justify-content: center; font-size: 3rem; font-weight: 700; color: white; box-shadow: 0 8px 24px rgba(0,0,0,0.3); transition: transform 2s cubic-bezier(0.25, 0.1, 0.25, 1);">?</div>
</div>
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 8px; font-weight: 600;">๋ฐฐํ
๊ธ์ก</label>
<input type="number" id="rouletteBet" value="10" min="1" max="${chips}" style="width: 100%; padding: 12px; border: 2px solid var(--m-text-muted); border-radius: 8px; background: var(--m-surface); color: var(--m-text); font-size: 1rem;">
</div>
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 8px; font-weight: 600;">๋ฐฐํ
ํ์
</label>
<select id="rouletteBetType" style="width: 100%; padding: 12px; border: 2px solid var(--m-text-muted); border-radius: 8px; background: var(--m-surface); color: var(--m-text); font-size: 1rem;">
<option value="red">๋นจ๊ฐ (ํ๋ฅ 48.6%, ๋ฐฐ๋น 2๋ฐฐ)</option>
<option value="black">๊ฒ์ (ํ๋ฅ 48.6%, ๋ฐฐ๋น 2๋ฐฐ)</option>
<option value="even">์ง์ (ํ๋ฅ 48.6%, ๋ฐฐ๋น 2๋ฐฐ)</option>
<option value="odd">ํ์ (ํ๋ฅ 48.6%, ๋ฐฐ๋น 2๋ฐฐ)</option>
<option value="low">๋ฎ์ ์(1-18) (ํ๋ฅ 48.6%, ๋ฐฐ๋น 2๋ฐฐ)</option>
<option value="high">๋์ ์(19-36) (ํ๋ฅ 48.6%, ๋ฐฐ๋น 2๋ฐฐ)</option>
<option value="zero">0๋ฒ (ํ๋ฅ 2.7%, ๋ฐฐ๋น 35๋ฐฐ)</option>
</select>
</div>
<button id="spinRoulette" style="width: 100%; padding: 16px; background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: white; border: none; border-radius: 12px; font-size: 1.2rem; font-weight: 700; cursor: pointer; transition: transform 0.2s;">๐ก ๋ฃฐ๋ ๋๋ฆฌ๊ธฐ</button>
<div id="rouletteResult" style="margin-top: 24px; padding: 16px; border-radius: 8px; text-align: center; font-weight: 600; display: none;"></div>
`;
document.getElementById('spinRoulette').addEventListener('click', () => {
const bet = parseInt(document.getElementById('rouletteBet').value);
const betType = document.getElementById('rouletteBetType').value;
if (bet > chips) {
alert('์นฉ์ด ๋ถ์กฑํฉ๋๋ค!');
return;
}
chips -= bet;
sessionStorage.setItem('casinoChips', chips);
document.getElementById('chipAmount').textContent = chips;
// ๋ฃฐ๋ ํ์ ์ ๋๋ฉ์ด์
const wheel = document.getElementById('rouletteWheel');
wheel.style.transform = `rotate(${Math.random() * 3600 + 720}deg)`;
setTimeout(() => {
// ๊ฒฐ๊ณผ ๊ณ์ฐ (0~36)
const result = Math.floor(Math.random() * 37);
const isRed = [1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36].includes(result);
const isEven = result > 0 && result % 2 === 0;
const isLow = result >= 1 && result <= 18;
let win = 0;
let match = false;
if (betType === 'red' && isRed) { match = true; win = bet * 2; }
else if (betType === 'black' && !isRed && result !== 0) { match = true; win = bet * 2; }
else if (betType === 'even' && isEven) { match = true; win = bet * 2; }
else if (betType === 'odd' && !isEven && result !== 0) { match = true; win = bet * 2; }
else if (betType === 'low' && isLow) { match = true; win = bet * 2; }
else if (betType === 'high' && result >= 19) { match = true; win = bet * 2; }
else if (betType === 'zero' && result === 0) { match = true; win = bet * 35; }
chips += win;
sessionStorage.setItem('casinoChips', chips);
document.getElementById('chipAmount').textContent = chips;
wheel.textContent = result;
wheel.style.background = result === 0 ? '#10b981' : (isRed ? '#ef4444' : '#1f2937');
wheel.style.transform = 'rotate(0deg)';
const resultDiv = document.getElementById('rouletteResult');
resultDiv.style.display = 'block';
if (match) {
resultDiv.style.background = 'rgba(16, 185, 129, 0.2)';
resultDiv.style.color = '#10b981';
resultDiv.innerHTML = `๐ ๋น์ฒจ! ${result}๋ฒ | +${win - bet} ์นฉ`;
} else {
resultDiv.style.background = 'rgba(239, 68, 68, 0.2)';
resultDiv.style.color = '#ef4444';
resultDiv.innerHTML = `๐ข ๊ฝ! ${result}๋ฒ | -${bet} ์นฉ`;
}
addHistory('๋ฃฐ๋ ', `${result}๋ฒ`, bet, win - bet);
}, 2000);
});
} else if (game === 'slot') {
area.innerHTML = '<p style="text-align: center; color: var(--m-text-muted);">์ฌ๋กฏ๋จธ์ ์ค๋น ์ค...</p>';
} else if (game === 'dice') {
area.innerHTML = '<p style="text-align: center; color: var(--m-text-muted);">์ฃผ์ฌ์ ๊ฒ์ ์ค๋น ์ค...</p>';
}
}
// ์ด๊ธฐ ๋ก๋ (๋ฃฐ๋ )
loadGame('roulette');
```
๋ฃฐ๋ ํ ์ด 2์ด๊ฐ ํ์ ํ๊ณ , 0~36 ์ค ๋๋ค ๊ฒฐ๊ณผ๊ฐ ๋์ต๋๋ค. ๋ฐฐํ
ํ์
์ ๋ฐ๋ผ ๋น์ฒจ ์ฌ๋ถ์ ๋ฐฐ๋น๊ธ์ด ๊ณ์ฐ๋๋ฉฐ, ์นฉ ์์ก๊ณผ ํ์คํ ๋ฆฌ๊ฐ ์๋ ์
๋ฐ์ดํธ๋ฉ๋๋ค.
๊ธฐ๋ ๊ฒฐ๊ณผ: ํ์ด์ง ๋ก๋ ์ ๋ฃฐ๋ ๊ฒ์์ด ์๋์ผ๋ก ํ์๋ฉ๋๋ค. ๋ฐฐํ ๊ธ์ก๊ณผ ํ์ ์ ์ ํํ ํ '๋ฃฐ๋ ๋๋ฆฌ๊ธฐ' ๋ฒํผ์ ๋๋ฅด๋ฉด ํ ์ด 2์ด๊ฐ ํ์ ํ๊ณ ๊ฒฐ๊ณผ ๋ฒํธ๊ฐ ๋ํ๋ฉ๋๋ค. ๋น์ฒจ ์ ์ด๋ก์ ๋ฐฐ๊ฒฝ์ '๐ ๋น์ฒจ!' ๋ฉ์์ง์ ๋ฐฐ๋น๊ธ์ด, ๊ฝ์ผ ์ ๋นจ๊ฐ์ ๋ฐฐ๊ฒฝ์ '๐ข ๊ฝ!' ๋ฉ์์ง๊ฐ ํ์๋ฉ๋๋ค. ์นฉ ์์ก์ด ์ค์๊ฐ์ผ๋ก ์ฆ๊ฐํ๊ณ , ํ์คํ ๋ฆฌ์ ํ๋ ์ด ๊ธฐ๋ก์ด ์ถ๊ฐ๋ฉ๋๋ค.
**3๋จ๊ณ: ์ฌ๋กฏ๋จธ์ & ์ฃผ์ฌ์ ๊ฒ์ ๊ตฌํ**
`loadGame()` ํจ์์ ์ฌ๋กฏ๋จธ์ ๊ณผ ์ฃผ์ฌ์ ๊ฒ์ ๋ก์ง์ ์ถ๊ฐํด์ฃผ์ธ์.
**์์ ํ ๋ถ๋ถ: `loadGame()` ํจ์์ `else if (game === 'slot')` ๋ฐ `else if (game === 'dice')` ๋ธ๋ก**
```javascript
} else if (game === 'slot') {
area.innerHTML = `
<h2 style="text-align: center; font-size: 1.8rem; font-weight: 700; margin-bottom: 24px;">๐ฐ ์ฌ๋กฏ๋จธ์ </h2>
<div style="display: flex; gap: 16px; justify-content: center; margin-bottom: 24px;">
<div id="reel1" style="width: 100px; height: 120px; background: linear-gradient(135deg, #f59e0b, #eab308); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 3rem; box-shadow: var(--m-shadow); transition: transform 0.5s;">๐</div>
<div id="reel2" style="width: 100px; height: 120px; background: linear-gradient(135deg, #f59e0b, #eab308); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 3rem; box-shadow: var(--m-shadow); transition: transform 0.5s;">๐</div>
<div id="reel3" style="width: 100px; height: 120px; background: linear-gradient(135deg, #f59e0b, #eab308); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 3rem; box-shadow: var(--m-shadow); transition: transform 0.5s;">๐</div>
</div>
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 8px; font-weight: 600;">๋ฐฐํ
๊ธ์ก</label>
<input type="number" id="slotBet" value="10" min="1" max="${chips}" style="width: 100%; padding: 12px; border: 2px solid var(--m-text-muted); border-radius: 8px; background: var(--m-surface); color: var(--m-text); font-size: 1rem;">
</div>
<button id="spinSlot" style="width: 100%; padding: 16px; background: linear-gradient(135deg, #f59e0b, #eab308); color: white; border: none; border-radius: 12px; font-size: 1.2rem; font-weight: 700; cursor: pointer;">๐ฐ ๋ฆด ๋๋ฆฌ๊ธฐ</button>
<div id="slotResult" style="margin-top: 24px; padding: 16px; border-radius: 8px; text-align: center; font-weight: 600; display: none;"></div>
<div style="margin-top: 16px; padding: 16px; background: rgba(59, 130, 246, 0.1); border-radius: 8px; font-size: 0.9rem; color: var(--m-text-muted);">
<strong>๋ฐฐ๋นํ:</strong><br>
๐ฐ 777 (์ญํ): 100๋ฐฐ<br>
๐๐๐ / ๐๐๐ / ๐๐๐: 20๋ฐฐ<br>
๊ฐ์ ๊ทธ๋ฆผ 2๊ฐ: 3๋ฐฐ
</div>
`;
const symbols = ['๐', '๐', '๐', '๐ฐ'];
document.getElementById('spinSlot').addEventListener('click', () => {
const bet = parseInt(document.getElementById('slotBet').value);
if (bet > chips) {
alert('์นฉ์ด ๋ถ์กฑํฉ๋๋ค!');
return;
}
chips -= bet;
sessionStorage.setItem('casinoChips', chips);
document.getElementById('chipAmount').textContent = chips;
// ๋ฆด ์ ๋๋ฉ์ด์
const reels = [document.getElementById('reel1'), document.getElementById('reel2'), document.getElementById('reel3')];
reels.forEach((reel, i) => {
reel.style.transform = 'translateY(-50px)';
setTimeout(() => {
const result = symbols[Math.floor(Math.random() * symbols.length)];
reel.textContent = result;
reel.style.transform = 'translateY(0)';
}, 300 * (i + 1));
});
setTimeout(() => {
const r1 = reels[0].textContent;
const r2 = reels[1].textContent;
const r3 = reels[2].textContent;
let win = 0;
let msg = '';
if (r1 === '๐ฐ' && r2 === '๐ฐ' && r3 === '๐ฐ') {
win = bet * 100;
msg = '๐ ์ญํ! 777';
} else if (r1 === r2 && r2 === r3) {
win = bet * 20;
msg = '๐ 3๊ฐ ์ผ์น!';
} else if (r1 === r2 || r2 === r3 || r1 === r3) {
win = bet * 3;
msg = 'โจ 2๊ฐ ์ผ์น!';
} else {
msg = '๐ข ๊ฝ!';
}
chips += win;
sessionStorage.setItem('casinoChips', chips);
document.getElementById('chipAmount').textContent = chips;
const resultDiv = document.getElementById('slotResult');
resultDiv.style.display = 'block';
if (win > 0) {
resultDiv.style.background = 'rgba(16, 185, 129, 0.2)';
resultDiv.style.color = '#10b981';
resultDiv.innerHTML = `${msg} | +${win - bet} ์นฉ`;
} else {
resultDiv.style.background = 'rgba(239, 68, 68, 0.2)';
resultDiv.style.color = '#ef4444';
resultDiv.innerHTML = `${msg} | -${bet} ์นฉ`;
}
addHistory('์ฌ๋กฏ๋จธ์ ', `${r1}${r2}${r3}`, bet, win - bet);
}, 1200);
});
} else if (game === 'dice') {
area.innerHTML = `
<h2 style="text-align: center; font-size: 1.8rem; font-weight: 700; margin-bottom: 24px;">๐ฒ ์ฃผ์ฌ์ ๊ฒ์</h2>
<div style="display: flex; gap: 16px; justify-content: center; margin-bottom: 24px;">
<div id="dice1" style="width: 80px; height: 80px; background: white; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; box-shadow: var(--m-shadow); transition: transform 0.5s;">๐ฒ</div>
<div id="dice2" style="width: 80px; height: 80px; background: white; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; box-shadow: var(--m-shadow); transition: transform 0.5s;">๐ฒ</div>
</div>
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 8px; font-weight: 600;">๋ฐฐํ
๊ธ์ก</label>
<input type="number" id="diceBet" value="10" min="1" max="${chips}" style="width: 100%; padding: 12px; border: 2px solid var(--m-text-muted); border-radius: 8px; background: var(--m-surface); color: var(--m-text); font-size: 1rem;">
</div>
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 8px; font-weight: 600;">์์ธก ํฉ</label>
<input type="number" id="diceGuess" value="7" min="2" max="12" style="width: 100%; padding: 12px; border: 2px solid var(--m-text-muted); border-radius: 8px; background: var(--m-surface); color: var(--m-text); font-size: 1rem;">
</div>
<button id="rollDice" style="width: 100%; padding: 16px; background: linear-gradient(135deg, #10b981, #14b8a6); color: white; border: none; border-radius: 12px; font-size: 1.2rem; font-weight: 700; cursor: pointer;">๐ฒ ์ฃผ์ฌ์ ๊ตด๋ฆฌ๊ธฐ</button>
<div id="diceResult" style="margin-top: 24px; padding: 16px; border-radius: 8px; text-align: center; font-weight: 600; display: none;"></div>
<div style="margin-top: 16px; padding: 16px; background: rgba(59, 130, 246, 0.1); border-radius: 8px; font-size: 0.9rem; color: var(--m-text-muted);">
<strong>๋ฐฐ๋นํ:</strong><br>
ํฉ ๋ง์ถ๊ธฐ: 5๋ฐฐ<br>
์ค๋ค์ดํฌ ์์ด์ฆ(1+1): 30๋ฐฐ<br>
๋๋ธ(๊ฐ์ ์ซ์ 2๊ฐ): 10๋ฐฐ
</div>
`;
document.getElementById('rollDice').addEventListener('click', () => {
const bet = parseInt(document.getElementById('diceBet').value);
const guess = parseInt(document.getElementById('diceGuess').value);
if (bet > chips) {
alert('์นฉ์ด ๋ถ์กฑํฉ๋๋ค!');
return;
}
chips -= bet;
sessionStorage.setItem('casinoChips', chips);
document.getElementById('chipAmount').textContent = chips;
// ์ฃผ์ฌ์ ์ ๋๋ฉ์ด์
const dice1El = document.getElementById('dice1');
const dice2El = document.getElementById('dice2');
dice1El.style.transform = 'rotate(360deg)';
dice2El.style.transform = 'rotate(-360deg)';
setTimeout(() => {
const d1 = Math.floor(Math.random() * 6) + 1;
const d2 = Math.floor(Math.random() * 6) + 1;
const sum = d1 + d2;
dice1El.textContent = d1;
dice2El.textContent = d2;
dice1El.style.transform = 'rotate(0deg)';
dice2El.style.transform = 'rotate(0deg)';
let win = 0;
let msg = '';
if (d1 === 1 && d2 === 1) {
win = bet * 30;
msg = '๐ ์ค๋ค์ดํฌ ์์ด์ฆ!';
} else if (d1 === d2) {
win = bet * 10;
msg = '๐ ๋๋ธ!';
} else if (sum === guess) {
win = bet * 5;
msg = 'โ
ํฉ ๋ง์ถค!';
} else {
msg = '๐ข ๊ฝ!';
}
chips += win;
sessionStorage.setItem('casinoChips', chips);
document.getElementById('chipAmount').textContent = chips;
const resultDiv = document.getElementById('diceResult');
resultDiv.style.display = 'block';
if (win > 0) {
resultDiv.style.background = 'rgba(16, 185, 129, 0.2)';
resultDiv.style.color = '#10b981';
resultDiv.innerHTML = `${msg} ${d1}+${d2}=${sum} | +${win - bet} ์นฉ`;
} else {
resultDiv.style.background = 'rgba(239, 68, 68, 0.2)';
resultDiv.style.color = '#ef4444';
resultDiv.innerHTML = `${msg} ${d1}+${d2}=${sum} | -${bet} ์นฉ`;
}
addHistory('์ฃผ์ฌ์', `${d1}+${d2}=${sum}`, bet, win - bet);
}, 800);
});
}
```
์ฌ๋กฏ๋จธ์ ์ 3๊ฐ ๋ฆด์ด ์์ฐจ์ ์ผ๋ก ๋ฉ์ถ๋ฉฐ ์กฐํฉ์ ํ์ธํ๊ณ , ์ฃผ์ฌ์๋ 2๊ฐ๊ฐ ํ์ ํ๋ฉฐ ํฉ์ ๊ณ์ฐํฉ๋๋ค. ๊ฐ ๊ฒ์์ ๋ฐฐ๋นํ๊ฐ ํ๋ฉด์ ํ์๋์ด ํ๋ฅ ์ ์ฝ๊ฒ ์ดํดํ ์ ์์ต๋๋ค.
๊ธฐ๋ ๊ฒฐ๊ณผ: ์ฌ๋กฏ๋จธ์ ํญ ํด๋ฆญ ์ 3๊ฐ ๋ฆด์ด ํ์๋๊ณ , ๋ฆด ๋๋ฆฌ๊ธฐ ๋ฒํผ์ ๋๋ฅด๋ฉด ์์ฐจ์ ์ผ๋ก ๋ฉ์ถ๋ฉฐ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฌ์ค๋๋ค. 777 ์ญํ, 3๊ฐ ์ผ์น, 2๊ฐ ์ผ์น์ ๋ฐ๋ผ ๋ฐฐ๋น๊ธ์ด ์ง๊ธ๋ฉ๋๋ค. ์ฃผ์ฌ์ ํญ ํด๋ฆญ ์ 2๊ฐ ์ฃผ์ฌ์์ ์์ธก ํฉ ์ ๋ ฅ๋์ด ๋ํ๋๊ณ , ๊ตด๋ฆฌ๊ธฐ ๋ฒํผ์ ๋๋ฅด๋ฉด ์ฃผ์ฌ์๊ฐ ํ์ ํ ๊ฒฐ๊ณผ๋ฅผ ํ์ํฉ๋๋ค. ์ค๋ค์ดํฌ ์์ด์ฆ(1+1), ๋๋ธ(๊ฐ์ ์ซ์), ํฉ ๋ง์ถ๊ธฐ ์กฐ๊ฑด์ ๋ฐ๋ผ ๋ฐฐ๋น์ด ๋ฌ๋ผ์ง๋๋ค. ๋ชจ๋ ๊ฒ์ ๊ฒฐ๊ณผ๊ฐ ํ์คํ ๋ฆฌ์ ๋์ ๋ฉ๋๋ค.
์ ์ถ๋ ์ํ (0)
๋ก๊ทธ์ธ ํ ์ ์ถ์์ง ์ ์ถ๋ ์ํ์ด ์์ต๋๋ค. ์ฒซ ๋ฒ์งธ ๋์ ์๊ฐ ๋์ด๋ณด์ธ์!