|
@ -59,6 +59,41 @@ function drawBoard(arr){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//spielbrett objekt Struktur
|
|
|
|
|
|
function boardObject(){ |
|
|
|
|
|
|
|
|
|
|
|
this.type; |
|
|
|
|
|
this.start; |
|
|
|
|
|
this.end; |
|
|
|
|
|
} |
|
|
|
|
|
//leiter Objekte(anfang , ende)
|
|
|
|
|
|
let leitern = [[7, 33],[24, 44],[31, 55],[60, 77]]; |
|
|
|
|
|
//schlange Objekte (anfang , ende)
|
|
|
|
|
|
let schlangen = [[99, 56], [86, 64],[60, 28],[18,1]]; |
|
|
|
|
|
//fullen des Objekts array
|
|
|
|
|
|
function generateBoardObjects (leitern, schlangen, objectArray){ |
|
|
|
|
|
|
|
|
|
|
|
for(let i = 0; i < leitern.length; i++){ |
|
|
|
|
|
let leiter = new boardObject; |
|
|
|
|
|
leiter.type = "l"; |
|
|
|
|
|
leiter.start = leitern[i][0]; |
|
|
|
|
|
leiter.end = leitern[i][1]; |
|
|
|
|
|
objectArray.push(leiter); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for(let i = 0; i < schlangen.length; i++){ |
|
|
|
|
|
let schlange = new boardObject; |
|
|
|
|
|
schlange.type = "s"; |
|
|
|
|
|
schlange.start = schlangen[i][0]; |
|
|
|
|
|
schlange.end = schlangen[i][1]; |
|
|
|
|
|
objectArray.push(schlange); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|