Skip to content

Conversation

@xovbd
Copy link

@xovbd xovbd commented May 10, 2025

Description:

This PR introduces the Go client for the connect4 game, which is designed to
interact with the game server.

Changes:

  • Go Client Implementation:

    • The Go client connects to the game server via WebSocket, requests the acutal
      game states and send the column number where to insert the next coin.
    • It supports bot selection via command-line flags, allowing users to choose
      between different bots (e.g. RandomBot, MyBot).
  • Bot Implementation:

    • The bot implements logic for returning a column number where to insert the
      next coin.
    • It supports multiple types of bots, including an example bot and a template
      for creating custom bots.
    • The bot types can be extended easily using the provided BotFactory.
  • Configuration:

    • Command-line flags allow users to configure the bot behavior and specify
      server details (bot tu use and server port number).
    • New bots can be created by copying and modifying the provided mybot.go
      file.
  • Project Structure:

    • The project structure follows a clean separation of concerns with clear
      directories for cmd, internal and model.

Installation & Usage:

  • The project can be built using Go 1.23.5 or higher.
  • Dependencies are handled via Go modules.
  • The bot is configured via command-line flags, including options for the port
    and bot type.

Example Usage:

# Build the bot
go build -o connect4 cmd/main.go

# Run the bot
./connect4-bot --port 8765 --bot RandomBot

Testing:

  • The bot has been tested with the game server to ensure it can connect and
    respond correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant