Git Product home page Git Product logo

connect-four's Introduction

Connect-Four

A recreation of the popular game of Connect-Four featuring an AI player with multiple difficulties. This web app was built purely using Rust and WebAssembly. We used Rocket as the backend framework, Yew as the frontend framework, and Cargo-Web as the build tool. Check out this sweet video for more details!

Get Started

Install build dependencies

sudo apt install -y build-essential pkg-config libssl-dev

Build the frontend

cargo install -f cargo-web

Go to the connect-four-frontend directory, then run:

bash build.sh

Install the database

Install and start MongoDB: https://www.mongodb.com/download-center/community

Start the backend

rustup default nightly

Go to the connect-four-backend directory, then run:

cargo run

See the result

Open the game at http://localhost:8000/

Run the CLI

Go to the connect-four-cli directory, then run:

cargo run

Built By

Dinula, Hugo and Kai

connect-four's People

Contributors

dinulade101 avatar jspenguin2017 avatar kai-bailey avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

connect-four's Issues

Connect 4 panic

Welcome to our game Command Line Interface.
Please choose between the following:
1) Connect-4
2) Toot and Otto
> 1
Select a game board size for Connect-4:
1) 6 x 7
2) 5 x 4
3) 6 x 5
4) 8 x 7
5) 9 x 7
6) 10 x 7
7) 8 x 8
> 1
Do you want to play against an AI or another human?
1) Human
2) AI
> 2
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _

Player 1's turn
Please select a column (0-6)
> 2
Bob Selected Column 2
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ R _ _ _ _

Player 2's turn
Bob Selected Column 4
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ R _ Y _ _

Player 1's turn
Please select a column (0-6)
> 4
Bob Selected Column 4
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ R _ _
_ _ R _ Y _ _

Player 2's turn
Bob Selected Column 5
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ R _ _
_ _ R _ Y Y _

Player 1's turn
Please select a column (0-6)
> 5
Bob Selected Column 5
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ R R _
_ _ R _ Y Y _

Player 2's turn
Bob Selected Column 6
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ R R _
_ _ R _ Y Y Y

Player 1's turn
Please select a column (0-6)
> 3
Bob Selected Column 3
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ R R _
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 3
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ Y R R _
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 3
Bob Selected Column 3
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ R _ _ _
_ _ _ Y R R _
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 6
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ R _ _ _
_ _ _ Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 6
Bob Selected Column 6
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ R _ _ R
_ _ _ Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 5
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ R _ Y R
_ _ _ Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 5
Bob Selected Column 5
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ _ _ R _
_ _ _ R _ Y R
_ _ _ Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 3
_ _ _ _ _ _ _
_ _ _ _ _ _ _
_ _ _ Y _ R _
_ _ _ R _ Y R
_ _ _ Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 3
Bob Selected Column 3
_ _ _ _ _ _ _
_ _ _ R _ _ _
_ _ _ Y _ R _
_ _ _ R _ Y R
_ _ _ Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 2
_ _ _ _ _ _ _
_ _ _ R _ _ _
_ _ _ Y _ R _
_ _ _ R _ Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 2
Bob Selected Column 2
_ _ _ _ _ _ _
_ _ _ R _ _ _
_ _ _ Y _ R _
_ _ R R _ Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 2
_ _ _ _ _ _ _
_ _ _ R _ _ _
_ _ Y Y _ R _
_ _ R R _ Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 2
Bob Selected Column 2
_ _ _ _ _ _ _
_ _ R R _ _ _
_ _ Y Y _ R _
_ _ R R _ Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 4
_ _ _ _ _ _ _
_ _ R R _ _ _
_ _ Y Y _ R _
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 4
Bob Selected Column 4
_ _ _ _ _ _ _
_ _ R R _ _ _
_ _ Y Y R R _
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 4
_ _ _ _ _ _ _
_ _ R R Y _ _
_ _ Y Y R R _
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 4
Bob Selected Column 4
_ _ _ _ R _ _
_ _ R R Y _ _
_ _ Y Y R R _
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 5
_ _ _ _ R _ _
_ _ R R Y Y _
_ _ Y Y R R _
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 5
Bob Selected Column 5
_ _ _ _ R R _
_ _ R R Y Y _
_ _ Y Y R R _
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 6
_ _ _ _ R R _
_ _ R R Y Y _
_ _ Y Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 6
Bob Selected Column 6
_ _ _ _ R R _
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 6
_ _ _ _ R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 2
Bob Selected Column 2
_ _ R _ R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 2's turn
Bob Selected Column 3
_ _ R Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 0
Bob Selected Column 0
_ _ R Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
R _ R R Y Y Y

Player 2's turn
Bob Selected Column 1
_ _ R Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
R Y R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 1
Bob Selected Column 1
_ _ R Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ _ R R Y Y R
_ R Y Y R R Y
R Y R R Y Y Y

Player 2's turn
Bob Selected Column 1
_ _ R Y R R Y
_ _ R R Y Y R
_ _ Y Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
R Y R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 1
Bob Selected Column 1
_ _ R Y R R Y
_ _ R R Y Y R
_ R Y Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
R Y R R Y Y Y

Player 2's turn
Bob Selected Column 1
_ _ R Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
R Y R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 1
Bob Selected Column 1
_ R R Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
R Y R R Y Y Y

Player 2's turn
Bob Selected Column 0
_ R R Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
_ Y R R Y Y R
Y R Y Y R R Y
R Y R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 1
Column is full. Please try again with different column
_ R R Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
_ Y R R Y Y R
Y R Y Y R R Y
R Y R R Y Y Y

Player 1's turn
Please select a column (0-6)
> 0
Bob Selected Column 0
_ R R Y R R Y
_ Y R R Y Y R
_ R Y Y R R Y
R Y R R Y Y R
Y R Y Y R R Y
R Y R R Y Y Y

Player 2's turn
thread 'main' panicked at 'Uniform::sample_single called with low >= high', src\main.rs:1:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\connect_four_cli.exe` (exit code: 101)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.