Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ljacqu/hearts
PHP implementation of the Hearts card game
https://github.com/ljacqu/hearts
card-game hearts php player
Last synced: 2 months ago
JSON representation
PHP implementation of the Hearts card game
- Host: GitHub
- URL: https://github.com/ljacqu/hearts
- Owner: ljacqu
- Created: 2015-03-30T20:23:34.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-09-03T13:59:55.000Z (over 2 years ago)
- Last Synced: 2024-04-16T18:21:07.536Z (9 months ago)
- Topics: card-game, hearts, php, player
- Language: PHP
- Homepage: https://jalu.ch/coding/hearts
- Size: 118 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Hearts in PHP
=============
A PHP 5 implementation of the card game [Hearts](https://en.wikipedia.org/wiki/Hearts).
In a round, the player of the largest card in the hand's suit takes the lot and
has to start the next round. Cards of the Hearts suit cost you one point each;
the queen of spades gives you 13 points. You want to get as few points as
possible.This implementation does not require players to pass cards among each other in
the beginning. If a player collects all 26 points in a hand, he won't get any
points and all other players will receive 26 points. The game ends once a
player has reached 100 points.States
------
The `Game` class maintains a `$state` to keep track of what actions it
expects. The table below shows the transitions from state to state.| old v / new > | HAND_START | AWAITING_CLUBS | AWAITING_HUMAN | ROUND_END | GAME_END |
| ------------- | ---------- | -------------- | -------------- | --------- | -------- |
| **HAND_START** | — | Continue button + human has 2♣ | Continue button + human NOT with 2♣ | — | — |
| **AWAITING_CLUBS** | — | — | — | Human played 2♣ | — | — |
| **AWAITING_HUMAN** | — | — | — | valid human card + more to play | valid human card + no more cards | — |
| **ROUND_END** | No one with >= 100 points | — | — | — | — | Someone with >= 100 points |
| **GAME_END** | — | — | — | — | — |