/go-connect4

Go implementation of Connect4

Primary LanguageGoMIT LicenseMIT

Go-connect4

Go-connect4 is a Go implementation of the board game Connect4.

Check out connect4.quibbble.com to play a live version of this game. This website utilizes connect4 frontend code, go-connect4 game logic, and go-quibbble server logic.

Quibbble Connect4

Usage

To play a game create a new Connect4 instance:

builder := Builder{}
game, err := builder.Create(&bg.BoardGameOptions{
    Teams: []string{"TeamA", "TeamB"}, // must contain at least 2 and at most 3 teams
})

To place a disk do the following action:

err := game.Do(&bg.BoardGameAction{
    Team: "TeamA",
    ActionType: "PlaceDisk",
    MoreDetails: PlaceDiskActionDetails{
        Column: 0, // columns 0 to 6 are valid
    },
})

To get the current state of the game call the following:

snapshot, err := game.GetSnapshot("TeamA")