Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rvinas/connect-4-prolog
Connect 4 game in Prolog
https://github.com/rvinas/connect-4-prolog
Last synced: 6 days ago
JSON representation
Connect 4 game in Prolog
- Host: GitHub
- URL: https://github.com/rvinas/connect-4-prolog
- Owner: rvinas
- License: apache-2.0
- Created: 2017-03-12T20:21:54.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-13T05:33:50.000Z (almost 8 years ago)
- Last Synced: 2024-11-01T09:43:43.643Z (about 2 months ago)
- Language: Prolog
- Homepage:
- Size: 15.6 KB
- Stars: 4
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Connect 4 Prolog
## Description
Connect 4 is a two player board game that takes place in a 6x7 grid. Players alternatively drop their discs into one of the 7 columns of the grid.
A column is always filled up from bottom to top. The player who achieves the connection of 4 discs (horizontally, vertically or diagonally) wins the game.
The game ends up in a draw when the grid is full without any straight connection of 4 discs from a single player.This repository is intended to serve as an exercise to learn Prolog. We implement the Connect 4 game providing a naive machine player, which tries to achieve the following goals within a single depth level (priority decreases from top to bottom items):
* Win within a movement.
* Intercept a 4-connection from the opponent, placing the disc in a spot that increases a machine's connection.
* Intercept a 4-connection from the opponent.
* Play arbitrarily. By default, it drags the disc in the first free spot from left to right columns.## Requirements
We recommend using the GNU Prolog Compiler ([gprolog](http://www.gprolog.org/)) developed by Daniel Diaz. Once gprolog is installed, the steps to run the game are straightforward:
* Execute `gprolog` in command line.
* Once in gprolog environment, compile with `[connect4].`.
* Finally, run game with `connect4.`. Enter a character from A to G to drop a disc down to the associated column.It may also work with other compilers, although we haven't tested them.
## Further improvements
We leave the following items as open improvements:
* Develop an Artificial Intelligence for the game in Prolog.
* Develop a user interface.