.
This commit is contained in:
parent
c7eeb61153
commit
efde0e7f08
|
@ -82,10 +82,10 @@ function playingAT(col){
|
||||||
|
|
||||||
//find the first line empty
|
//find the first line empty
|
||||||
var i=0;
|
var i=0;
|
||||||
for(i = 0; i < 6 , grid[i][col] !== ""; i++){
|
for(i = 0; i < 6 , board[i][col] !== ""; i++){
|
||||||
//nothing juste a counter
|
//nothing juste a counter
|
||||||
}
|
}
|
||||||
grid[i][col]=symbol;
|
board[i][col]=symbol;
|
||||||
document.getElementById('td' + col + '_' + i).innerHTML = symbol;
|
document.getElementById('td' + col + '_' + i).innerHTML = symbol;
|
||||||
addLog('player ' + currentPlayer + ', symbol ' + symbol + ' played col ' + col);
|
addLog('player ' + currentPlayer + ', symbol ' + symbol + ' played col ' + col);
|
||||||
|
|
||||||
|
@ -100,10 +100,10 @@ function playingAT(col){
|
||||||
//horizontaly
|
//horizontaly
|
||||||
var line="";
|
var line="";
|
||||||
for (var k=0; k < 7; k++){
|
for (var k=0; k < 7; k++){
|
||||||
if(grid[y][k] == ""){
|
if(board[y][k] == ""){
|
||||||
line += " ";
|
line += " ";
|
||||||
}else{
|
}else{
|
||||||
line += grid[y][k];
|
line += board[y][k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (line.indexOf(searchValue) > -1){
|
if (line.indexOf(searchValue) > -1){
|
||||||
|
@ -114,10 +114,10 @@ function playingAT(col){
|
||||||
//verticaly
|
//verticaly
|
||||||
var line="";
|
var line="";
|
||||||
for (var k=0; k < 6; k++){
|
for (var k=0; k < 6; k++){
|
||||||
if(grid[k][x] == ""){
|
if(board[k][x] == ""){
|
||||||
line += " ";
|
line += " ";
|
||||||
}else{
|
}else{
|
||||||
line += grid[k][x];
|
line += board[k][x];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (line.indexOf(searchValue) > -1){
|
if (line.indexOf(searchValue) > -1){
|
||||||
|
@ -151,10 +151,10 @@ function playingAT(col){
|
||||||
var line="";
|
var line="";
|
||||||
var lx , ly;
|
var lx , ly;
|
||||||
for (lx = kx, ly = ky; (lx < 7) && (ly > -1); lx++ , ly-- ){
|
for (lx = kx, ly = ky; (lx < 7) && (ly > -1); lx++ , ly-- ){
|
||||||
if( grid[ly][lx] == ""){
|
if( board[ly][lx] == ""){
|
||||||
line += " ";
|
line += " ";
|
||||||
}else{
|
}else{
|
||||||
line += grid[ly][lx];
|
line += board[ly][lx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,10 +181,10 @@ function playingAT(col){
|
||||||
var line="";
|
var line="";
|
||||||
var lx , ly;
|
var lx , ly;
|
||||||
for (lx = kx , ly = ky ; (lx < 7) && (ly < 6) ; lx++ , ly++){
|
for (lx = kx , ly = ky ; (lx < 7) && (ly < 6) ; lx++ , ly++){
|
||||||
if( grid[ly][lx] == ""){
|
if( board[ly][lx] == ""){
|
||||||
line += " ";
|
line += " ";
|
||||||
}else{
|
}else{
|
||||||
line += grid[ly][lx];
|
line += board[ly][lx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ function play(player){
|
||||||
"action" : "play-turn",
|
"action" : "play-turn",
|
||||||
"game" : "connectFour",
|
"game" : "connectFour",
|
||||||
"players" : 2,
|
"players" : 2,
|
||||||
"board" : grid,
|
"board" : board,
|
||||||
"you" : symbol,
|
"you" : symbol,
|
||||||
"player-index" : player-1
|
"player-index" : player-1
|
||||||
};
|
};
|
||||||
|
@ -255,8 +255,8 @@ function startGame(){
|
||||||
while (document.getElementById("fightResult").firstChild) {
|
while (document.getElementById("fightResult").firstChild) {
|
||||||
document.getElementById("fightResult").removeChild(document.getElementById("fightResult").firstChild);
|
document.getElementById("fightResult").removeChild(document.getElementById("fightResult").firstChild);
|
||||||
}
|
}
|
||||||
//create grid
|
//create board
|
||||||
var table=createElem('table',{'class':'battleGrid', 'id': 'grid'});
|
var table=createElem('table',{'class':'battleGrid', 'id': 'board'});
|
||||||
for (var i=6; i > -1; i--){
|
for (var i=6; i > -1; i--){
|
||||||
var tr=createElem('tr');
|
var tr=createElem('tr');
|
||||||
for (var j=0;j<7; j++){
|
for (var j=0;j<7; j++){
|
||||||
|
@ -277,7 +277,7 @@ function startGame(){
|
||||||
newTr.appendChild(newTd);
|
newTr.appendChild(newTd);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('grid').appendChild(newTr);
|
document.getElementById('board').appendChild(newTr);
|
||||||
|
|
||||||
board=[["","","","","","",""],
|
board=[["","","","","","",""],
|
||||||
["","","","","","",""],
|
["","","","","","",""],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user