This is a web application to play the game Teeko, a strategic game played on a 5x5 board.
Each player starts with 4 stones, either black or red. Each player takes turns placing either red or black stones on the board, with black always starting. Once all stones are placed,
players can move their stones horizontally, vertically, or diagonally by 1 tile per turn. If no player wins within 1000 half-moves (each single turn counts as one half-move), the game ends in a draw.
This project was created by Danea Hassler as part of a bachelor thesis in computer science under the supervision of
Oswin Aichholzer at
Graz University of Technology.
The User Interface with the style and the server was build upon a previous project by Marvin Gutgesell.
The server is written in Python 3, using the Flask framework.
The client is written in HTML and JavaScript, using jQuery. Compatibility was tested in Safari and Firefox on macOS.
The same tests were conducted on iOS, and on Windows using Firefox and Microsoft Edge. On Linux, tests were carried out with Google Chrome and Firefox.
The application is expected to work in most modern browsers.
Basics
The AI in this game is based on a comprehensive database containing all possible board configurations and every legal move,
along with the number of half-moves required to reach a win or a loss or the information that a move leads to a draw under perfect play.
A green number shown in a field indicates that making this move will lead to a guaranteed win in at most that number of half-moves,
assuming the winning player plays optimally.
A red number means the move leads to a certain loss in the indicated number of half-moves, under perfect play from both players.
A letter D signifies that the move results in a draw, assuming both players play optimally.
Winning moves are always shown in green and carry even numbers,
while losing moves are marked in red and have odd numbers.
If the opponent makes a suboptimal move, an earlier win may still be possible.
Features
- Restart game: Restart the game, but keep your AI settings.
- Toggle move infos: Show or hide the number of halfmoves to a win/loss or a draw.
- Recommend move: Get one of the best moves, which can be played at the time.
- Undo last move: Undo the last move to try out another one.
- Redo last move: Redo the last undone move.
- Save game: Save your current game locally in the browser.
- Load game: Load one of your saved games to continue playing.
- Delete game: Delete one of your saved games, if not needed anymore.
- AI for Player black/red: Switch the AI for player black/red on or off.
- AI Level black/red: Set the level with which the AI decides the next move.
- Perfect: The AI will choose one of the best moves to win as quickly as possible.
- Just win: The AI will choose a move that leads to a win, not necessarily the fastest.
- Random: The AI will play a random legal move.
- AI Speed: Set the speed at which the AI takes the next move.
- Winning Conditions: Choose the conditions under which you want to play. Changing this settings will restart the game.
- Info Button: Check what each winning condition looks like.
- History: Shows the history of moves that were made.
- History Redo: Shows the history of moves that were undone.
Control info
At the beginning of the game, players enter the placement phase, during which they take turns placing their four pieces on the board.
All valid fields for placement are highlighted in yellow.
Once all pieces are placed, the game transitions into the movement phase. In this phase, players take turns moving one of their own pieces
exactly one tile either (horizontally, vertically, or diagonally) to an adjacent empty field.
Pieces that can be moved are marked in orange. After selecting a piece, all valid destinations for that move are again marked in yellow,
while the selected piece itself is highlighted in a bright yellow.
For more details look at the rules. Rules
Close
Rules
Teeko is a fast-paced, strategic two-player game invented by John Scarne. This version offers several AI levels
and customizable winning conditions to provide a challenging experience. The following section provides a complete
overview of the rules and features of this digital implementation.
Game Setup
- Teeko has a board with a 5 x 5 grid.
- It is a two-player game.
- Each player has 4 stones - either black or red.
- The black player always begins.
Objective
- The goal of Teeko is to be the first player to get one of the selected winning positions
with the own four stones.
Game Phases
-
Place Phase:
- The players take turns and place one of their 4 stones on the board.
- Only empty fields can be selected for placement.
- Valid fields for placement are highlighted in yellow.
-
Move Phase:
- Once all 8 stones are placed on the board, the movement phase begins.
- All stones which are able to move, are marked in orange.
- Clicking a movable stone highlights it in bright yellow. Clicking it again will deselect it.
- The valid destination fields are marked in yellow. A stone can be moved by clicking one of these fields.
- Valid fields to move are adjacent empty fields (horizontally, vertically, diagonally 1 field away).
Visual Markers:
= valid moves,
= movable stones,
= selected stone.
End of Game
- The game ends immediatly after a player fulfills one of the selected winning conditions.
- If no one wins within 1000 half-moves (each single turn counts as one half-move), the game ends in a draw.
AI
- The game can be played against an AI-player or one can choose two AI-players, which then can play against each other.
- You can choose between three AI difficulty levels:
- Perfect: The AI will choose one of the best moves to win as quickly as possible.
- Just win: The AI will choose a move that leads to a win, not necessarily the fastest.
- Random: The AI will play a random legal move.
- The speed with which the AI makes moves can be set with the sliding bar.
Move Evaluations
- On each valid move, a number or a letter is displayed as an evaluation.
- Green numbers (even numbers): These indicate that the move leads to a certain win in at most that number of half-moves,
assuming the winning player plays optimally.
- Red numbers (odd numbers): These indicate that the move leads to a certain loss in that number of half-moves, assuming optimal play from both players.
- D: The move will lead to a draw assuming perfect play from both players.
Winning Conditions
- Changing this settings will restart the game.
- Depending on your game settings, one or multiple winning conditions may be active at the same time. The images show winning positions for the black player.
- Horizontal and Vertical: All four stones must form a straight, uninterrupted line either horizontally or vertically.
- 2×2 Boxes: All four stones must form a compact 2×2 square without gaps.
- Diagonal Lines: All four stones must be aligned diagonally across the board without any interruption.
- 45-Degree Boxes: All four stones form a diamond-shaped (rotated square) configuration.
- Large Aligned Squares: All four stones are placed at the corners of a grid-aligned square with equal spacing. 2x2 boxes are not leading to a win with this condition.
- Skew Large Squares: All four stones form a tilted square not aligned with rows or columns, showing symmetry with diagonals. 45-Degree Boxes are not included.
- All win conditions are visually illustrated below for better understanding.
Horizontal and Vertical
|
2×2 Boxes
|
Diagonal Lines
|
45-Degree Boxes
|
Large Aligned Squares
|
Skew Large Squares
|
Other Features
- Restart game: Restart the game, but keep your AI settings.
- Toggle move infos: Show or hide the number of halfmoves to a win/loss or a draw.
- Recommend move: Get one of the best moves, which can be played at the time.
- Undo last move: Undo the last move to try out another one.
- Redo last move: Redo the last undone move.
- Save game: Save your current game locally in the browser.
- Load game: Load one of your saved games to continue playing.
- Delete game: Delete one of your saved games, if not needed anymore.
- History: Shows the history of moves that were made.
- History Redo: Shows the history of moves that were undone.
Close