Simon Says Kata

Simon is a game of short-term memory skill. The device creates a series of tones and lights and requires a user to repeat the sequence. If the user succeeds, the series becomes progressively longer and more complex.

Rules

  • The computer generates a random color (green, red, blue or yellow) [and a tone linked to that color]
  • If the player presses the correct combination of colors, a new color will be appended at the end of the list
  • If the player selects an incorrect color, then the game is over
  • The game runs until the player loses

Output

Welcome to the game!
Simon will show you a sequence of colors, repeat the sequence by entering the colors separated by a space.
The colors are: Red [R], Blue [B], Yellow [Y] and Green [G].

Simon says: yellow
Your turn: y
Good job!

Simon says: yellow green
Your turn: y g
Good job!

Simon says: yellow green blue
Your turn: y g r
Game over!

PHP with PHPUnit

  1. Install composer curl -sS https://getcomposer.org/installer | php
  2. composer install (inside the php folder)
  3. vendor/bin/phpunit or composer test

Javascript with Jest

  1. Install Node
  2. npm install (Being in the javascript folder)
  3. npm test

Typescript with Deno

  1. Install Deno
  2. deno test (Being in the typescript folder)

Java with Junit and Mockito

  1. Install dependencies and tests with Maven [mvn test].
  2. Run the tests with the IDE

Scala with Munit and Scalacheck

  1. sbt (in scala folder)
  2. ~test to run the tests on hot reload

Linux/Mac

  1. Install SDKMan
  2. sdk install java 11.0.12-open install OpenJDK
  3. sdk install sbt once SDKMan is installed.

Windows

  1. Install OpenJDK
  2. Install SBT

Visual Studio Code

  1. Download Visual Studio Code
  2. Install for VS Code Metals

Kotlin with JUnit5 and MockK

  1. By console: You can install dependencies and launch tests with gradlew test.
  2. Using IDE: Simply open the project from the root of the Kotlin template.

C# with xUnit (with Fluent Assertions) and NSubstitute

  1. Install Microsoft Visual Studio Community 2022
  2. Open the project and it will automatically download the required Nuguet packages

Python with pytest

  1. Install python 3.x
  2. After downloading the source code into the */python/ folder, create a virtual environment:
  3. python3 -m venv env 4.
  4. Activate in virtual environment:
  • windows: .\env\Scripts\activate.bat 5.
  • linux/mac: source env/bin/activate.
  1. pytest to run the tests.