Table of Contents
This repository is part of the Koi Koi Online project.
This is a library that represents a traditional hanafuda deck only, no specific game logics.
<dependency>
<groupId>io.github.pmamico</groupId>
<artifactId>hanafuda-lib</artifactId>
<version>1.0</version>
</dependency>HanafudaDeck deck = new HanafudaDeck();
deck.shuffle();
PlayingCard cardFromTop = deck.draw();A newly constructed HanafudaDeck contains all the 48 playing cards.
Suits represented by HanafudaCardSuit enum
Basically the suits are the 12 months.
However it is supported to use flower names as aliases in english and romaji also.
e.g. the January suit is represented as HanafudaCardSuit.JAN, HanafudaCardSuit.PINE or HanafudaCardSuit.MATSU
You can use the naming according to your taste!
Values represented by HanafudaCardType enum.
Values are PLAIN, RIBBON, BLUE_RIBBON, POETRY_RIBBON, ANIMAL and BRIGHT
Cards represented by PlayingCard class having properties above:
- a
HanafudaCardSuit - a
HanafudaCardType - a
label(String)
All special cards that have unique name or role has an own class (that extends PlayingCard).
For example "Full moon" is one of the bright cards and represented by FullMoon class so you can easily check against that or create it:
//check if card is a full moon card
PlayingCard card = new HanafudaDeck().draw();
if(card instanceof FullMoon){
...
}
//or create a FullMoon card
PlayingCard fullMoon = new FullMoon();Each special cards has a label, for example the FullMoon's label is "Full Moon with Red Sky".
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this library better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/MyFeature) - Commit your Changes (
git commit -m 'added my feature') - Push to the Branch (
git push origin feature/MyFeature) - Open a Pull Request
Hanafuda or “flower cards” are a style of Japanese playing cards with some Portuguese backgrounds from the mid-16th century.
Fun fact Nintendo originally produced handmade hanafuda playing cards in 1889.
The system of the deck is different from French-suited or Bavarian pattern decks that makes the card intersting.
A Hanafuda deck contains 48 cards in 12 suits, 4 cards each suit.
Suits represented by characteristic flowers of the 12 months, eg. the "march" suit represented by cherry blossom.
Each card has a "type" or "value" also, that can be "Plain", "Animal", "Ribbon", "Poetry ribbon", "Blue ribbon" or the most valuable type "Bright".
Not all the suits have all value card which makes the deck asymmetric. (there are 4 cards per suit, but there are 6 values)
For example the February suited cards:
![]() |
![]() |
![]() |
![]() |
|
| suit | plum blossom or february; suited cards illustrates the same flower | |||
| type | animal | poetry ribbon |
plain | plain |
A typical game with Hanafuda cards called Koi-Koi
where you match pairs by suit but you earn points for making combinations by type.
You can check the actual rules here: Koi-Koi Rules
(NOTE combinations called Yaku)
Distributed under the MIT License. See LICENSE.txt for more information.
Mico Papp - papp.mico@gmail.com


