Categorygithub.com/edward-/four-in-a-row-game
repository
0.0.0-20240627213050-80ca719f1412
Repository: https://github.com/edward-/four-in-a-row-game.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

4 in A Row [GAME]

drawing

Game Description

4inARow is a digital rendition of the classic connect-four game where two players take turns dropping colored discs from the top into a seven-column, six-row vertically suspended grid. The objective is to be the first to form a horizontal, vertical, or diagonal line of four of one's own discs.

This game is built in Go, offering a a group of endpoints for the experience. 4inARow combines strategy, foresight, and a bit of luck, making each game unique and engaging.

How to Start

Prerequisites

  • Go 1.22 or higher installed on your machine.
  • Docker Desktop 4.28.0

Run

you could need to install migrate-cli:

make migrate-install

or

go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest

Run local

   make compose-up
   make migrate-up
   make run

Run tests

   make compose-up
   make migrate-test-up
   make test

Run all in docker

   make compose-app-up

Now, you can start playing the game calling some endpoints [I need a cli, in the future :)]. endpoints:

GET    /ping
POST   /v1/users
GET    /v1/users/:userId
POST   /v1/games
GET    /v1/games/:gameId
GET    /v1/games/:gameId/board
POST   /v1/games/:gameId/turn

Or use the swagger documentation in:

Local = http://localhost:8080/docs
Stagging = [working on]-staging.com
production = [wordking on]-prod.com

Architecture

This project adopts the Clean Architecture principles, ensuring that the game's design is independent of frameworks, UI, and databases. By segregating the system into layers (Domain, Infrastructure, Interface Adapters, and Frameworks & Drivers), we enhance maintainability, scalability, and the potential for future feature expansions. This architectural choice facilitates unit testing and decouples business logic from device-specific implementations.

Stack Tech Used

  • Programming Language: Go (Golang) - chosen for its simplicity, performance, and efficient concurrency support.
  • Game Logic: The core game logic is implemented in pure Go, focusing on simplicity and performance to handle game states, player turns, and victory conditions efficiently.

Docs&Tech

TODO

  • Implement swagger documentation
  • Validate tests with github-actions
  • Terraform
  • Create CI/CD with github actions
  • Deploy image to EC2
  • Implement AI opponent with varying difficulty levels.
  • Add cli functionality.
  • Create a graphical user interface (GUI) version using a Go-based GUI library like Fyne.
  • Optimize performance for handling larger grids or multiple simultaneous games.

Contributing

We welcome contributions of all kinds from the community! If you're interested in making 4inARow even better, feel free to fork the repository, make your changes, and submit a pull request. For more details, check out our CONTRIBUTING.md file (to be created).

License 4inARow[Game] is released under the MIT License. See the LICENSE file in the repository for more details.