Skip to content

Truvam/connect-four

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python node npm

Connect Four

Web:

Visit: https://truvam.github.io/connect-four/

OR

$ git clone https://github.com/Truvam/connect-four.git
$ cd connect-four/
(Make sure you have all dependencies listed above installed)
$ node static_server.js
$ node backend/index.js
Visit: http://localhost:8080/

Python:

Installation:

Version: Python 3.5.2
$ git clone $ https://github.com/Truvam/connect-four.git
$ cd connect-four/

Example:

Input:

$ python3 connect_four.py
Connect Four:
1: Player vs Player
2: Player vs PC
3: PC vs PC
Option: 2
1: AI - MiniMax
2: AI - Alpha-Beta
Option: 2
Difficulty:
Depth: 4 (Easy)  Depth: 6 (Medium)  Depth: 8 (Hard)
Depth: 6
Do you want to play first? [y/n]: y
  0 1 2 3 4 5 6
 _______________
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
 ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
You are 'O' and PC is 'X'
Press ? if you want the best move.
Your turn.
Choose column: ?
Best move: column 3
Your turn.
Choose column: 3
  0 1 2 3 4 5 6
 _______________
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ O _ _ _ |
 ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
PC turn.
  0 1 2 3 4 5 6
 _______________
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ _ _ _ _ |
| _ _ _ X _ _ _ |
| _ _ _ O _ _ _ |
 ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Time to play: 4.811264 s
Memory used: 6.868 MB
Number of generated nodes: 84819
Your turn.
Choose column: 2