All Projects → pchampio → othello-prolog

pchampio / othello-prolog

Licence: BSD-3-Clause license
📜 A fully functional Othello (Reversi) game, with several AIs, made in prolog for swipl.

Programming Languages

prolog
421 projects

Projects that are alternatives of or similar to othello-prolog

AnimalChess
Animal Fight Chess Game(斗兽棋) written in rust.
Stars: ✭ 76 (+533.33%)
Mutual labels:  board-game, minmax
checkers
A game of checkers written using minmax algorithm and alpha-beta pruning.
Stars: ✭ 19 (+58.33%)
Mutual labels:  alpha-beta, minmax
quinto
a board game lost to the sands of time
Stars: ✭ 27 (+125%)
Mutual labels:  board-game
Student-Portal
An app for students made as a part of a code jam
Stars: ✭ 54 (+350%)
Mutual labels:  student-project
tictacNET
Solving Tic-Tac-Toe with Neural Networks.
Stars: ✭ 17 (+41.67%)
Mutual labels:  board-game
ColorByNumber-iOS
Color by Number: a pixel coloring game on iOS.
Stars: ✭ 50 (+316.67%)
Mutual labels:  board-game
pentobi
Computer opponent for the board game Blokus.
Stars: ✭ 44 (+266.67%)
Mutual labels:  board-game
deerportal
Full of the diamonds 💎 board game driven by a 🦌 Deer 🦌 god and classical elements 🔥 💦 💨 🌍
Stars: ✭ 31 (+158.33%)
Mutual labels:  board-game
godpaper
🐵 An AI chess-board-game framework(by many programming languages) implementations.
Stars: ✭ 40 (+233.33%)
Mutual labels:  board-game
connect4
🎮 It is a two-player connection game in which the players first choose a color and then take turns dropping one colored disc from the top into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the lowest available space within the column, user wins by forming row of four of same color
Stars: ✭ 18 (+50%)
Mutual labels:  board-game
obb-rules
Orion's Belt BattleGrounds battle engine
Stars: ✭ 13 (+8.33%)
Mutual labels:  board-game
chess
The game of Chess
Stars: ✭ 25 (+108.33%)
Mutual labels:  board-game
Mzinga
Open-source software to play the board game Hive.
Stars: ✭ 57 (+375%)
Mutual labels:  board-game
Sneakers Project
Using Selenium, Neha scraped data about 35 top selling sneakers of Nike and Adidas from stockx.com. She used this data to draw insights about sneaker resales.
Stars: ✭ 32 (+166.67%)
Mutual labels:  student-project
NemeStats
NemeStats is a completely free website for tracking board games played among a relatively stable group of players.
Stars: ✭ 43 (+258.33%)
Mutual labels:  board-game
shogi-rs
A Bitboard-based shogi library in Rust. Board representation, move generation/validation and time control utilities.
Stars: ✭ 39 (+225%)
Mutual labels:  board-game
Carcassonne
A digital version of the board game Carcassonne, implemented in Java. This desktop computer game supports up to five players at the same time (shared-screen multiplayer mode).
Stars: ✭ 70 (+483.33%)
Mutual labels:  board-game
scrabble
Implements Scrabble. Also allows user to recover all game moves from given board and score list as well as brute-force find best move.
Stars: ✭ 38 (+216.67%)
Mutual labels:  board-game
B2P-Penicilin-Tablut-AI
Java-based artificial intelligence that plays Tablut using Ashton's rules
Stars: ✭ 27 (+125%)
Mutual labels:  board-game
RestaurantReactApp
This is a responsive website that uses PWA app standards, completely created with React, React router and firebase
Stars: ✭ 59 (+391.67%)
Mutual labels:  student-project

Othello Prolog

A fully functional Othello game, with several AIs, made for the swi prolog interpreter

ScreenShot~ demo

Overview

This app allows 2 players to play an Othello game.

During de pre-game menu the admin can set the two players to human or AIs.

-- Set the Player x to be a --
 1. Human  ---> User input. prompt.pl
 2. Bot (random)   ---> A totally random AI. random.pl 
 3. Bot (minmax)   ---> An AI using the min-max algorithm. minmax.pl
 4. Bot (alphabeta) ---> An AI using the alpha-beta algorithm. alphabeta.pl  

Usage

Play

Load the file in the swipl-interpreter:

$ swipl ./othello.pl

Play the game:

>?- play.

Things about this implementation

Heuristic/Evaluation function

I used this excellent heuristic/evaluation function, made by researchers from the University of Washington.

This heuristic function is actually a collection of several heuristics and calculates the utility value of a board position by assigning different weights to those heuristics here.

The heuristic takes into account:

  • The coin parity here
  • The mobility here
  • The corners captured here
  • The stability here

Performances

To ensure the best performance and to improve the bot playing time the Game Engine use a cache.pl system.

The Cache saves the Heuristic value of a given board. here.

This method saves (roughly):

  • 20000 call out of 36000 when running a AlphaBeta of Depth 4 (-1min30 save on my machine 2min10 vs 3min40).
  • 66000 call out of 77000 when running a MinMax of Depth 4 (-9min save on my machine 11min vs 20min).

The Cache is also used to save some computing time of the next board generation witch in his own cut the number of call to this rule by half (20 seconds save).

MinMax Vs AlphaBeta (depth = 3)

MinMax vs AlphaBeta

Note that the overall trend in counts analyzed by Min-Max increases in the first third following a Gaussian strongly pronounced. This is because the board is free, and many combinations are allowed. In the next 2 thirds, the descent is also done according to the distribution of gauss, since the number of game combinations decreases gradually as we reach the edges.

In depth 6 we have 3.8 million board analyzed, to play an obvious shot find in depth 2.
Evidence appears: Alpha-Beta is still not the reincarnation of pure optimization ...

Note

I always write the test of the rule/predicate, below and indented by 3 tabs of the definition of itself.

Todo

 1. +/-inf heuristic when wining/losing. (some plays are more rewards than a winning one..)

 2. Dynamic stability_weights - The stability_weights penalize the player making a move on a adjacent corners cell. But if the same player own the related corner it's actualy not a bad move..

 3. Dynamic weights in the dynamic_heuristic_evaluation

     - At the start we need to reduce the opponent mobility
     - In the middle game we need to focus on the stability of your placement
     - In the very end of the game we only focus on the coin parity

 4. Remove the ugly if/then/else

 5. Make use of board symmetrys to improve the Cache systems

 6. GnuProlog (2x faster)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].