File size: 5,165 Bytes
05a4a28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58cd89f
 
 
 
05a4a28
 
 
 
 
58cd89f
05a4a28
 
58cd89f
05a4a28
 
58cd89f
05a4a28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58cd89f
 
05a4a28
 
 
 
 
 
 
 
 
 
 
 
 
 
58cd89f
 
05a4a28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58cd89f
05a4a28
 
 
 
58cd89f
05a4a28
 
 
 
 
 
 
 
 
 
58cd89f
 
 
05a4a28
 
 
58cd89f
05a4a28
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Go Game</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
            background-image: url('Go.jpg');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            font-family: Arial, sans-serif;
            padding: 20px;
        }

        .game-container {
            background: rgba(222, 184, 135, 0.9);
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0,0,0,0.3);
        }

        /* Rest of the CSS remains the same */
        .board {
            display: grid;
            grid-template-columns: repeat(19, 30px);
            grid-template-rows: repeat(19, 30px);
            gap: 0px;
            background: #DEB887;
            border: 2px solid #000;
            position: relative;
        }

        .intersection {
            width: 30px;
            height: 30px;
            position: relative;
            cursor: pointer;
        }

        .intersection::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 0;
            width: 100%;
            height: 1px;
            background: #000;
        }

        .intersection::after {
            content: '';
            position: absolute;
            left: 50%;
            top: 0;
            height: 100%;
            width: 1px;
            background: #000;
        }

        .stone {
            position: absolute;
            width: 26px;
            height: 26px;
            border-radius: 50%;
            top: 2px;
            left: 2px;
            z-index: 1;
            transition: all 0.2s ease;
        }

        .black {
            background: #000;
            box-shadow: 2px 2px 2px rgba(0,0,0,0.2);
        }

        .white {
            background: #fff;
            box-shadow: 2px 2px 2px rgba(0,0,0,0.2);
        }

        .controls {
            margin-top: 20px;
            display: flex;
            gap: 10px;
        }

        button {
            padding: 10px 20px;
            font-size: 16px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            background: #4CAF50;
            color: white;
            transition: background 0.3s;
        }

        button:hover {
            background: #45a049;
        }

        .score {
            margin-top: 20px;
            font-size: 18px;
            display: flex;
            gap: 20px;
            color: white;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }

        .mode-select {
            margin-bottom: 20px;
        }

        select {
            padding: 8px;
            font-size: 16px;
            border-radius: 5px;
        }
    </style>
</head>
<body>
    <audio id="stoneSoundEffect" src="BGM.mp4"></audio>
    
    <div class="mode-select">
        <select id="gameMode">
            <option value="pvp">Player vs Player</option>
            <option value="ai">Player vs AI</option>
        </select>
    </div>

    <div class="game-container">
        <div class="board" id="board"></div>
    </div>

    <div class="score">
        <div>Black Score: <span id="blackScore">0</span></div>
        <div>White Score: <span id="whiteScore">0</span></div>
    </div>

    <div class="controls">
        <button id="passBtn">Pass</button>
        <button id="resetBtn">Reset</button>
    </div>

    <script>
        class GoGame {
            constructor() {
                this.size = 19;
                this.board = Array(this.size).fill().map(() => Array(this.size).fill(null));
                this.currentPlayer = 'black';
                this.lastMove = null;
                this.passes = 0;
                this.gameMode = 'pvp';
                this.score = { black: 0, white: 0 };
                this.capturedStones = { black: 0, white: 0 };
                this.stoneSound = document.getElementById('stoneSoundEffect');
                
                this.initialize();
            }

            // Previous methods remain the same

            placeStone(row, col) {
                if(this.board[row][col] === null) {
                    this.board[row][col] = this.currentPlayer;
                    this.renderStone(row, col);
                    this.captures();
                    this.passes = 0;
                    this.currentPlayer = this.currentPlayer === 'black' ? 'white' : 'black';
                    this.updateScore();
                    
                    // Play sound effect
                    this.stoneSound.currentTime = 0;
                    this.stoneSound.play();
                }
            }

            // Rest of the methods remain the same
        }

        const game = new GoGame();
    </script>
</body>
</html>