This package is an implementation of the Mastermind game.
This package requires PHP 7.4 or higher.
You can install the package via composer:
composer require gabbanaesteban/mastermind
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']
You can run the tests with:
composer test
The MIT License (MIT). Please see License File for more information.