Skip to content

▶️ This repository contains Hex game analyzer, which allows to get information about the current game board state as part of the Algorithms & Data Structures course.

License

Notifications You must be signed in to change notification settings

taryesz/hex-analyzer

Repository files navigation

Hex Analyzer

This project is an implementation of the Hex analyzer.

The user can provide the program with a board and then type various commands to get needed information.

First Example

Let's say you have the following board:

Hex board example of size 5x5

... and you want to find out its size.

To do that, input the board, and then type BOARD_SIZE.

First input

Hex board example of size 5x5

Second input

BOARD_SIZE

Output:

5

Second Example

What if you want to find out whether it's possible to win the game as the Red player by placing only one pawn, assuming that the opponent player makes the worst moves for themselves?

First input

Hex board example of size 5x5

Second input

CAN_RED_WIN_IN_1_MOVE_WITH_NAIVE_OPPONENT

Output:

NO

Available Queries

There are a couple of commands you can type in to get various board data:

  • BOARD_SIZE - shows the size of the board, the length of a side.
  • PAWNS_NUMBER - shows the amount of pawns placed on the board.
  • IS_BOARD_CORRECT - checks if the number of placed pawns of both players are correct [ e.g. there cannot be a situation where there are 12 Blues and only 1 Red ].
  • IS_GAME_OVER - checks if any of the players wins.
  • IS_BOARD_POSSIBLE - checks if the player, who is considered a winner of the game, has only one winning path.
  • CAN_#_WIN_IN_1_MOVE_WITH_NAIVE_OPPONENT - checks if a player can win the game by placing only 1 of their pawns, considering that the opponent player makes the worst moves.
  • CAN_#_WIN_IN_2_MOVES_WITH_NAIVE_OPPONENT - checks if a player can win the game by placing only 2 of their pawns, considering that the opponent player makes the worst moves.

Not yet implemented:

  • CAN_#_WIN_IN_1_MOVE_WITH_PERFECT_OPPONENT - checks if a player can win the game by placing only 1 of their pawns, considering that the opponent player makes the best moves.
  • CAN_#_WIN_IN_2_MOVES_WITH_PERFECT_OPPONENT - checks if a player can win the game by placing only 2 of their pawns, considering that the opponent player makes the best moves.

NOTE: instead of # you have to write either BLUE or RED.

Running Tests

This repository contains a folder called "tests" where you can find 10 different .in files with various inputs and corresponding .out files with the correct outputs.

About

▶️ This repository contains Hex game analyzer, which allows to get information about the current game board state as part of the Algorithms & Data Structures course.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published