Skip to content

Commit

Permalink
Fix returning home, change colors + other bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mhawryluk committed Dec 31, 2023
1 parent 0432ff1 commit 9b0dac9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
4 changes: 0 additions & 4 deletions computerOpponents.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
function copyArray(array) {
return JSON.parse(JSON.stringify(array));
}

class ComputerOpponent {
constructor(game, player) {
this.game = game;
Expand Down
3 changes: 1 addition & 2 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ const playerPaths = {
[14, 8],
[14, 7],
[14, 6],
[14, 6],
[13, 6],
[12, 6],
[11, 6],
Expand Down Expand Up @@ -275,4 +274,4 @@ const safeTiles = [
[8, 2],
[6, 12],
[12, 8],
]
].concat(Object.values(playerPaths).map(path => path[0]));
2 changes: 1 addition & 1 deletion game.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class Game {
const takenStartPositions = tokens[player].map(token => {
// TODO: make it not dependent on the translation attribute in the visualization ;_;
const translation = token.getAttribute('translation').split(' ');
return [translation[2], translation[0]];
return [parseInt(translation[2]), parseInt(translation[0])];
});

for (let position of startPositions[player]) {
Expand Down
24 changes: 12 additions & 12 deletions initTiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ const B = 'blue';
const G = 'green';
const Y = 'yellow';
const R = 'red';
const X = '#f6e7db';
const W = '#e4cab9';
const Z = '#fff5ec';
const S = '#ffc181';
const W = '#e4cab9'; // center
const X = '#ffd6b1'; // regular tile, alternating - darker
const Z = '#faf1eb'; // regular tile, alternating - lighter
const S = '#b1b3ff'; // safe spaces

const tileColors = [
[B, B, B, B, B, B, X, Z, X, Y, Y, Y, Y, Y, Y],
[B, X, X, X, X, B, Z, Y, Y, Y, X, X, X, X, Y],
[B, X, B, B, X, B, S, Y, X, Y, X, Y, Y, X, Y],
[B, X, B, B, X, B, Z, Y, Z, Y, X, Y, Y, X, Y],
[B, X, X, X, X, B, X, Y, X, Y, X, X, X, X, Y],
[B, Z, Z, Z, Z, B, Z, Y, Y, Y, Z, Z, Z, Z, Y],
[B, Z, B, B, Z, B, S, Y, X, Y, Z, Y, Y, Z, Y],
[B, Z, B, B, Z, B, Z, Y, Z, Y, Z, Y, Y, Z, Y],
[B, Z, Z, Z, Z, B, X, Y, X, Y, Z, Z, Z, Z, Y],
[B, B, B, B, B, B, Z, Y, Z, Y, Y, Y, Y, Y, Y],
[X, B, X, Z, X, Z, W, W, W, Z, X, Z, S, Z, X],
[Z, B, B, B, B, B, W, W, W, G, G, G, G, G, Z],
[X, Z, S, Z, X, Z, W, W, W, Z, X, Z, X, G, X],
[R, R, R, R, R, R, Z, R, Z, G, G, G, G, G, G],
[R, X, X, X, X, R, X, R, X, G, X, X, X, X, G],
[R, X, R, R, X, R, Z, R, Z, G, X, G, G, X, G],
[R, X, R, R, X, R, X, R, S, G, X, G, G, X, G],
[R, X, X, X, X, R, R, R, Z, G, X, X, X, X, G],
[R, Z, Z, Z, Z, R, X, R, X, G, Z, Z, Z, Z, G],
[R, Z, R, R, Z, R, Z, R, Z, G, Z, G, G, Z, G],
[R, Z, R, R, Z, R, X, R, S, G, Z, G, G, Z, G],
[R, Z, Z, Z, Z, R, R, R, Z, G, Z, Z, Z, Z, G],
[R, R, R, R, R, R, X, Z, X, G, G, G, G, G, G],
];

Expand Down
6 changes: 5 additions & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ function arraysEqual(a, b) {
}

return true;
}
}

function copyArray(array) {
return JSON.parse(JSON.stringify(array));
}

0 comments on commit 9b0dac9

Please sign in to comment.