From a034279b572a0f7831f42f52c6fe4e2db279e65f Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Mon, 10 Jul 2023 16:04:02 -0400 Subject: [PATCH] don't show the congrats popup as often --- build/index.js | 4 +++- js/board.js | 1 + js/game.js | 3 ++- move/sources/game_board_8192.move | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/build/index.js b/build/index.js index 0e52a64..de65642 100644 --- a/build/index.js +++ b/build/index.js @@ -20,6 +20,7 @@ module.exports = { display: (board) => { const { packedSpaces } = board; + // const packedSpaces = "7066750781832232977" const allColors = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13].map(i => `color${i}`); const tiles = eByClass('tile'); let topTile = 1; @@ -665,7 +666,8 @@ function handleResult(newBoard, direction) { confetti.run(); setTimeout(() => { - if ( + if (topTile < 9) return; + if ( topTile >= leaderboard.minTile() && newBoard.score > leaderboard.minScore() ) { diff --git a/js/board.js b/js/board.js index 70c76f4..9271a02 100644 --- a/js/board.js +++ b/js/board.js @@ -19,6 +19,7 @@ module.exports = { display: (board) => { const { packedSpaces } = board; + // const packedSpaces = "7066750781832232977" const allColors = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13].map(i => `color${i}`); const tiles = eByClass('tile'); let topTile = 1; diff --git a/js/game.js b/js/game.js index 327b50d..26adb98 100644 --- a/js/game.js +++ b/js/game.js @@ -274,7 +274,8 @@ function handleResult(newBoard, direction) { confetti.run(); setTimeout(() => { - if ( + if (topTile < 9) return; + if ( topTile >= leaderboard.minTile() && newBoard.score > leaderboard.minScore() ) { diff --git a/move/sources/game_board_8192.move b/move/sources/game_board_8192.move index 554d26d..81e7ef3 100644 --- a/move/sources/game_board_8192.move +++ b/move/sources/game_board_8192.move @@ -1290,4 +1290,22 @@ module ethos::game_board_8192 { TILE4, TILE4, TILE8, TILE2 ]), 1); } + + // #[test] + // fun test__valid_move() { + // let game_board = GameBoard8192 { + // packed_spaces: 7066750781832232977, + // score: 0, + // last_tile: vector[], + // top_tile: TILE1024, + // game_over: false + // }; + // move_direction(&mut game_board, DOWN, vector[1,2,3,4,5,6]); + // assert!(game_board_matches(&game_board, vector[ + // TILE32, EMPTY, EMPTY, TILE2, + // TILE8, EMPTY, EMPTY, EMPTY, + // TILE2, TILE8, EMPTY, EMPTY, + // TILE4, TILE4, TILE8, TILE2 + // ]), 1); + // } } \ No newline at end of file