In this project for the course MVC in web programming spring -21 I've made a game called Poker Squares. The aim of the game is to gather as many points as possible by playing out cards and create valuable poker hands. Score high and you might place yourself on top of the highscore list!
You can try the game here:
http://www.student.bth.se/~joki20/dbwebb-kurser/mvc/me/proj/public/
You have a grid consisting of 5x5 empty cells. Each turn a new card in the deck shows up and you have to click on one of the empty cells to place the card there. As soon as a row or column contains five cards, points for that poker hand is valued accordingly:
HAND | POINTS | EXPLAINATION |
---|---|---|
Royal Straight Flush | 100 | 10 J Q K A in same suit |
Straight Flush | 75 | Straight in same suit |
Four of a kind | 50 | Four of same value |
Full house | 25 | Three of the same value + Two pairs |
Flush | 20 | All cards in the same suit |
Straight | 15 | Cards with consecutive values |
Three of a kind | 10 | Three of the same value |
Two pairs | 5 | Two different pairs, each with same value |
Two pairs | 5 | Two cards with same value |
For a hand you can only score one of above. For example, If you have four of a kind, you will not also score for three of a kind.
After you finished a game, you can go watch the highscore list and see where you placed. The list contains the name you chose at the start of the game and your total sum of all ten hands.
In the histogram you can see the distribution of all previous hands played, in every game played (10 hands for each game). In this way you can analyze how common it is to score different kind of hands. For example, in time you can expect a Straight Flush to score less often compared to three of a kind since it is much harder to get.
To run this repository you need:
- Cygwin
- Git
- PHP in your path
- Composer (package manager for PHP)
- XAMPP
- MySQL WorkBench
-
Install Cygwin here
-
Install Git here. Select option "Use Git from the Windows Command Prompt", and then option "Checkout as-is, commit as-is" in order to not affect your files automatically. Check that git is installed in Cygwin by typing git --version
-
Make sure PHP is in your PATH: https://dbwebb.se/kunskap/lagg-php-i-pathen
-
Download Composer here
-
Download XAMPP here and follow this guide
Check that it works by typing make --version
- Download MySQL Workbench here
-
Make sure XAMPP is running on port 8080 with MySQL.
-
Click menu option 'Code' and copy the HTTPS or SSH link to this git and then type either of the following inside folder C:/xampp/htdocs in your terminal:
- git clone https://github.com/joki20/dbwebb-mvc-proj.git
- git clone [email protected]:libgit2/libgit2.git
This creates a directory dbwebb-mvc-proj in that folder, containing all the files for this repository.
-
Go to this folder and type composer install to download all php packages specified inside composer.json
-
Rename file env.example to .env
-
Start MySQL Workbench as 'root' user, no password and port 3306. These details can be found in the .env file. Run the file database/pokerhighscores.sql in order to setup the database and its table. It will create a database called 'joki20'.
-
You might have to run the command php artisan key:generate
-
Start playing the game by going to http://localhost:8080/dbwebb-mvc-proj/ and click 'public' folder