Spaces:
Running
Running
Update index.html
Browse files- index.html +3 -0
index.html
CHANGED
@@ -17,6 +17,7 @@
|
|
17 |
<script>
|
18 |
function BoardGame(agent, num_rows, num_cols) {
|
19 |
this.agent = agent;
|
|
|
20 |
this.num_cols = num_cols;
|
21 |
this.num_rows = num_rows;
|
22 |
var this_ = this;
|
@@ -87,6 +88,7 @@
|
|
87 |
let [_, y] = this_.get_candidate(x);
|
88 |
let i = y * this_.num_cols + x;
|
89 |
this_.board[i] = this_.who_play;
|
|
|
90 |
this_.who_play = -this_.who_play;
|
91 |
this_.render();
|
92 |
}
|
@@ -121,6 +123,7 @@
|
|
121 |
let i = this_.mouse_y * this_.num_cols + this_.mouse_x;
|
122 |
if (this_.board[i] != 0) return false;
|
123 |
this_.board[i] = this_.who_play;
|
|
|
124 |
this_.who_play = -this_.who_play;
|
125 |
this_.render();
|
126 |
this_.ai_play();
|
|
|
17 |
<script>
|
18 |
function BoardGame(agent, num_rows, num_cols) {
|
19 |
this.agent = agent;
|
20 |
+
this.audio = new Audio('/static/ntt123/Connect-4-Game/stone.ogg');
|
21 |
this.num_cols = num_cols;
|
22 |
this.num_rows = num_rows;
|
23 |
var this_ = this;
|
|
|
88 |
let [_, y] = this_.get_candidate(x);
|
89 |
let i = y * this_.num_cols + x;
|
90 |
this_.board[i] = this_.who_play;
|
91 |
+
this_.audio.play();
|
92 |
this_.who_play = -this_.who_play;
|
93 |
this_.render();
|
94 |
}
|
|
|
123 |
let i = this_.mouse_y * this_.num_cols + this_.mouse_x;
|
124 |
if (this_.board[i] != 0) return false;
|
125 |
this_.board[i] = this_.who_play;
|
126 |
+
this_.audio.play();
|
127 |
this_.who_play = -this_.who_play;
|
128 |
this_.render();
|
129 |
this_.ai_play();
|