Skip to content

Commit

Permalink
usable version 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl Yogi authored and Karl Yogi committed Aug 4, 2016
1 parent d86a725 commit b0d1391
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'stage': null,
'stage1': null,
'end': false,
'start': false,
'play': [],
'delay':200,
'x': {
Expand Down Expand Up @@ -293,7 +294,7 @@
var rtn = [];
if(checkMove(i))
{
checkMove(i);
// checkMove(i);
// setTimeout(function(){
board.stage.children[i-1].dispatchEvent('mousedown');
// }, board.delay);
Expand Down Expand Up @@ -321,18 +322,45 @@
return flag;
}

function wait(ms){
var start = new Date().getTime();
var end = start;
while(end < start + ms) {
end = new Date().getTime();
}
}

function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}

function getWinner() {
if(board.end)
return board.winner;
else
return false;
}

function isEnd() {
if(board.end)
return true;
else
return false;
}

window.onload = function() {

init();

// chooseRole('x');
// console.log(move(2));console.log(move(3));
chooseRole('x');
while(!isEnd())
{
// setInterval(function(){
var i = Math.floor(Math.random()*9)+1;
move(i);
// }, board.delay)

}
}
</script>
</html>

0 comments on commit b0d1391

Please sign in to comment.