Skip to content

tonyputi/poker-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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

Installation

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

Fast way using SQLite

open and update the .env file

...
...
DB_CONNECTION=sqlite
...
...

create the file where to store data

touch database/database.sqlite

Standard way using MySQL

  1. create a fresh database on your mysql instance
  2. 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

Serving application

To serve application run the follow command:

php artisan serve

  1. Open your browser and go to http://127.0.0.1:8000
  2. Click on register link on top-right corner and proceed to register a new user
  3. 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

Unit Test

Two main unit tests are provided with this project:

  1. Testing all the possible ranks
  2. Testing hands for all possible ranks including some special case

To run the test use the following command:

php artisan test

Command line

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

Docker Installation

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

  1. Open your browser and go to http://127.0.0.1:8000
  2. Click on register link on top-right corner and proceed to register a new user
  3. 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

Unit Test

Two main unit tests are provided with this project:

  1. Testing all the possible ranks
  2. 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages