This repo creates the well known werewolves game using Go Programming language. The program is architectured around using Actor model for defining the server and client programs. The communication mode is using gRPC which supports bidirectional streaming for RPCs.
- Download Windows installation section from the releases history.
- Downloading Golang
- Wget go files
wget https://go.dev/dl/go1.22.2.linux-amd64.tar.gz
- Run
sudo rm -rf /usr/local/go
to remove any existing installations - Run
sudo tar -C /usr/local -xzf go1.22.2.linux-amd64.tar.gz
to extract contents to local user path in Linux. - Run
export PATH=$PATH:/usr/local/go/bin
- Run
go version
(If the go version gets listed, your installation worked fine)
- Wget go files
- Get Werewolves repo
- Run
git clone https://github.com/codlocker/werewolves-go.git
- Or you can use Download ZIP or Download tar file in case git isn't installed in the system
- Run
- Ensure you are in the werewolf code repo (Run
cd werewolves-go/
) - Run
make build
-
The client and server builds are created in the /bin/ folder.
-
Clean existing builds by running
make clean
(if required).
- To run server execute command
- Execute:
cd bin/
- Execute:
./server
- Execute:
- To run client execute command (Open a new terminal window for each client you want to run)
- Execute:
cd bin/
- Execute (change username to a new name in every client window):
./client -username=<username>
- Examples:
./client username=a
- Examples:
./client username=b
- Examples:
./client username=c
- Examples:
./client username=d
- Examples:
- Execute:
POSSIBLE ERRORS
-
Go package missing or go.mod errors
- Run
go mod tidy
- Run
-
In case the above steps fail, you can directly run the code as follows
-
Server code:
cd server/
go run main.go
-
Client code:
cd client/
go run main.go
-