mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +00:00
2048: Evil AI logic: select new tile in the worst position
Not very smart: the worst position is defined such that after the player's next move the fewest tiles remain empty.
This commit is contained in:
parent
4434e900af
commit
a93d0fe8c2
3 changed files with 83 additions and 7 deletions
|
@ -76,7 +76,7 @@ int main(int argc, char** argv)
|
|||
main_widget.set_layout<GUI::VerticalBoxLayout>();
|
||||
main_widget.set_fill_with_background_color(true);
|
||||
|
||||
Game game { board_size, target_tile };
|
||||
Game game { board_size, target_tile, evil_ai };
|
||||
|
||||
auto& board_view = main_widget.add<BoardView>(&game.board());
|
||||
board_view.set_focus(true);
|
||||
|
@ -123,7 +123,7 @@ int main(int argc, char** argv)
|
|||
undo_stack.clear();
|
||||
redo_stack.clear();
|
||||
|
||||
game = Game(board_size, target_tile);
|
||||
game = Game(board_size, target_tile, evil_ai);
|
||||
|
||||
// This ensures that the sizes are correct.
|
||||
board_view.set_board(nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue