An open API service indexing awesome lists of open source software.

https://github.com/syniol/rock-paper-scissors-lizard-spock

Rock, Paper, Scissors, Lizard, and Spock CLI Game in Go (Golang)
https://github.com/syniol/rock-paper-scissors-lizard-spock

cli command-line-tool game go golang rock-paper-scissors-game rock-paper-scissors-lizard-spock

Last synced: 6 months ago
JSON representation

Rock, Paper, Scissors, Lizard, and Spock CLI Game in Go (Golang)

Awesome Lists containing this project

README

          

# Rock, Paper, Scissors, Lizard, Spock in Go (GoLang)
![workflow](https://github.com/syniol/rock-paper-scissors-lizard-spock/actions/workflows/pipeline.yml/badge.svg) ![workflow](https://github.com/syniol/rock-paper-scissors-lizard-spock/actions/workflows/release.yml/badge.svg)


Single Player Demo

Single Player Demo

Two Players Demo

Two Players Demo


The game invented by Sam Kass with his wife Karen Bryla is played between two players. Each player chooses one of the five options:
- **Rock**
- **Paper**
- **Scissors**
- **Lizard**
- **Spock**

The winner is determined by the following rules:

| **Choice** | **Wins Against** | **Reason** |
|--------------|------------------|----------------------------------|
| **Scissors** | Paper, Lizard | Cuts Paper, Decapitates Lizard |
| **Paper** | Rock, Spock | Covers Rock, Disproves Spock |
| **Rock** | Scissors, Lizard | Crushes Scissors, Crushes Lizard |
| **Lizard** | Paper, Spock | Eats Paper, Poisons Spock |
| **Spock** | Scissors, Rock | Smashes Scissors, Vaporizes Rock |

If both players choose the same option, the game results in a **tie**.

## Features and Acceptance Criteria
- [X] **Interactive Gameplay**: Players can select their choice, and the winner is determined based on the rules.
- [X] **Clear Visual Feedback**: Winning and losing outcomes are displayed in an engaging and intuitive way.
- [X] **Scoreboard**: Tracks the points of the user and the computer across multiple rounds.
- [X] **Data Persistence**: Retains the game state and scoreboard.
- [X] **Restart**: Allows the user to restart the game, clearing the scoreboard and resetting the game state.

## Motivation
I recently got asked to come in for a second interview at this awesome robotics company in London. I was super pumped about what they do.

However, the pair programming exercise could be pretty tough for me. I struggle with stress, and they switched up the technical challenge
at the last minute. The engineer assigned to the exercise seemed really nice, though. I think he was a bit let down, but he had no idea
about my ADD, which I always keep under wraps. I even flunked my motorbike test nine times before finally passing, and I never mentioned
my condition to the examiner.

This was one of their take-home exercises that I started but never got to demo, and I ended up failing the pairing exercise. I wrapped it
up just to save face, hoping the engineers at that company might see that I'm not as bad as I seem, haha.

## Up and Running
You can download the compiled binary for your operating system from [the release page](https://github.com/syniol/rock-paper-scissors-lizard-spock/releases). You could
also download and build from source code. You need to have a Go installation for version `1.24.x`.

```shell
./rpsls-cli-mac-os-arm64
```

For Unix based operating systems you could use:
```shell
make run
```

For Windows, please use the following command:
```shell
go run cmd\cli.go
```

### Dependencies
* [CLI Forms](https://github.com/charmbracelet/huh)
* [CLI Table Colour Format](https://github.com/fatih/color)
* [CLI Table Display](https://github.com/rodaine/table)

#### Credits
Author: [Hadi Tajallaei _(Genius Persian Child)_](mailto:hadi@syniol.com)

Copyright © 2025 Syniol Limited. All rights reserved.