This poker analyzer software is based on PHP and Laravel and of course there are many other ways to get better results in terms of performance such as using bit math but this is not the purpose of this test.
The involved files for that test are:
src
├── app
│ ├── Console
│ │ └── Commands
| | └── PokerAnalyzer.php
│ ├── Hand.php
│ ├── Http
│ │ └── Controllers
| | └── PokerAnalyzerController.php
│ ├── Services
│ │ ├── Card.php
│ │ ├── PlayerHand.php
│ │ └── PokerAnalyzer.php
│ └── User.php
├── database
│ ├── migrations
│ │ └── 2019_09_05_170207_create_hands_table.php
│ └── seeds
│ └── UserSeeder.php
├── resources
│ └── views
│ ├── analyzer.blade.php
│ ├── layouts
│ | └── app.blade.php
│ └── welcome.blade.php
├── routes
│ └── web.php
└── tests
└── Unit
├── HandTest.php
└── PlayerTest.php
Created by Filippo Sallemi
First clone the project on github
git clone git@github.com:tonyputi/united-remote.git
jump inside the project
cd united-remote/src
install composer dependencies
composer install
copy the enviroment
cp .env.example .env
open and update the .env file
...
...
DB_CONNECTION=sqlite
...
...
create the file where to store data
touch database/database.sqlite
- create a fresh database on your mysql instance
- update the .env file in according to your mysql configuration
...
...
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database-name
DB_USERNAME=your-username
DB_PASSWORD=your-password
...
...
execute database migration
php artisan migrate --seed
generate the application key
php artisan key:generate
To serve application run the follow command:
php artisan serve
- Open your browser and go to http://127.0.0.1:8000
- Click on register link on top-right corner and proceed to register a new user
- Upload the hands.txt file, click on analyze button and wait. The results will be showed after process finish
An user is already generated by the migrations:
username: filippo@sallemi.it
password: 12345678
Two main unit tests are provided with this project:
- Testing all the possible ranks
- Testing hands for all possible ranks including some special case
To run the test use the following command:
php artisan test
In this way the software will evalute the input file and print the results on the command line as a table.
php artisan poker:analyze ../docs/hands.txt
First clone the project on github
git clone git@github.com:tonyputi/united-remote.git
jump inside the project
cd united-remote/src
copy the enviroment
cp .env.example .env
update .env in according to your database configuration (sqlite/mysql)
build the docker image for the project
docker build . -t united-remote
run the docker image
docker run -it -p 8080:8000 -v
pwd/src:/app united-remote
- Open your browser and go to http://127.0.0.1:8000
- Click on register link on top-right corner and proceed to register a new user
- Upload the hands.txt file, click on analyze button and wait. The results will be showed after process finish
An user is already generated by the migrations:
username: filippo@sallemi.it
password: 12345678
Two main unit tests are provided with this project:
- Testing all the possible ranks
- Testing hands for all possible ranks including some special case
To run the test use the following command:
docker run -it united-remote test
that is a shortcut for:
docker run -it united-remote php artisan test