Skip to content

Mastermind game implementation in PHP

License

Notifications You must be signed in to change notification settings

gabbanaesteban/mastermind

Repository files navigation

Social Card of Mastermind

Mastermind

Latest Stable Version GitHub Workflow Status Total Downloads Latest Unstable Version License

This package is an implementation of the Mastermind game.

Requirements

This package requires PHP 7.4 or higher.

Installation

You can install the package via composer:

composer require gabbanaesteban/mastermind

Basic Usage

require_once __DIR__ . '/vendor/autoload.php';

use Gabbanaesteban\Mastermind\Mastermind;
use Gabbanaesteban\Mastermind\Color;

$mastermind = Mastermind::withRandomCode();

//OR

$mastermind = new Mastermind([
    Color::YELLOW, Color::GREEN, Color::PINK, Color::YELLOW
]);

$mastermind->getHints([
    Color::BLUE, Color::BLUE, Color::YELLOW, Color::YELLOW
]); // ['white', 'black']

Testing

You can run the tests with:

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.