Skip to content

bongyor/hanafuda-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Quality Gate Status Code Smells Duplicated Lines (%) Maintainability Rating Bugs

Logo

Hanafuda Lib

A java library for Hanafuda cards.
But what is Hanafuda?

Table of Contents
  1. About The Project
  2. Usage
  3. Roadmap
  4. Contributing
  5. What is Hanafuda?
  6. License
  7. Contact

About The Project

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.

(back to top)

Usage

Import with maven

<dependency>
    <groupId>io.github.pmamico</groupId>
    <artifactId>hanafuda-lib</artifactId>
    <version>1.0</version>
</dependency>

Deck

HanafudaDeck deck = new HanafudaDeck();
deck.shuffle();
PlayingCard cardFromTop = deck.draw();

A newly constructed HanafudaDeck contains all the 48 playing cards.

Suits

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

Values represented by HanafudaCardType enum.
Values are PLAIN, RIBBON, BLUE_RIBBON, POETRY_RIBBON, ANIMAL and BRIGHT

PlayingCard

Cards represented by PlayingCard class having properties above:

  • a HanafudaCardSuit
  • a HanafudaCardType
  • a label (String)

Special cards

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".

Roadmap

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/MyFeature)
  3. Commit your Changes (git commit -m 'added my feature')
  4. Push to the Branch (git push origin feature/MyFeature)
  5. Open a Pull Request

(back to top)

What is Hanafuda?

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
All cards here.

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)

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Mico Papp - papp.mico@gmail.com

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages