Implement LAN Commandline Coup Boardgame in C

Introduction

I am a fan of boardgame, especially Coup. In Coup, players are given two cards and attempt to eliminate the other players by lying and calling their bluffs until only one player remains. The gameplay is explained in Wikipedia. When I was in Vietnam, I invited my friends to my home or coffeeshop playing Coup. Living in South Korea, I sometimes play Coup online with my labmate via Chicken Koup. Although it has friendly interface, we are sometimes kicked out from the room due to some errors.

It motivated me making a Coup game using command-line-interface and LAN connection. To implement the game, I only need basic logical thinking, C programming, and basic socket programming. I put my code on github. It could be compiled and run on Linux or WSL.

fig1

Explanation

The application includes server-side and client-side app. The server hosts the game and communicates between players. The client acts as an CLI receiving decision from player, sending to game engine, and returning the command/result from server.

Build the server app

$ make server

Build the client app

$ make client

Run server app on server machine

$ ./server -n [NUM_PLAYERS]

Run client app on client machine

$ ./client -n [PLAYER_NAME]

Here is the demo of the game

fig1