|
|
@ -4,6 +4,7 @@ |
|
|
|
function PlayerBuilder(){ |
|
|
|
|
|
|
|
this.position = 1; |
|
|
|
this.newPosition; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -24,6 +25,8 @@ function buildPlayerArray(playerCount, boardArr){ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function movePlayer(player, roll){ |
|
|
|
|
|
|
|
player.position += roll; |
|
|
@ -33,3 +36,27 @@ if(player.position >= 99){ |
|
|
|
console.log(player.position); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//wandelt Zellennummer in html-Element um
|
|
|
|
function boardLocation(cellNumber){ |
|
|
|
var table = document.getElementById('board'); |
|
|
|
var found = false; |
|
|
|
var tableId; |
|
|
|
for(let i = 0; i < 10; i++){ |
|
|
|
for(let j = 0; j < 10; j++){//findet der zelle ID von Stellenummer
|
|
|
|
if(table.rows[i].cells[j].innerHTML == cellNumber){ |
|
|
|
found = 1; |
|
|
|
tableId = table.rows[i].cells[j].id; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(found == true){ |
|
|
|
|
|
|
|
return tableId; |
|
|
|
} |
|
|
|
else{ |
|
|
|
|
|
|
|
log.console("Error: Zellenummer nicht gefunden"); //Druckt Errror auf dem console wenn unerfolgereich
|
|
|
|
} |
|
|
|
} |