RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account
Forums → General →

Koi-Koi (Hanafuda)

Subscribe to Koi-Koi (Hanafuda) 22 posts, 7 voices

 
Nov 3, 2018 5:27pm
Avatar Rick Murray (539) 10812 posts

Back in 2012 I started work on a RISC OS implementation of an east Asian game known as “Koi-Koi” (Japan) or “Stop-Go” (Korea, I think?). It uses a deck of cards (smaller and thicker than western cards) arranged as 12 “months” of 4 cards.

Then, I completely forgot about it. Which wasn’t a surprise as I was working night shift at the time and I need to refer to my blog to remember anything from then.

I happened to come across the bits of the game that I had created recently, and decided to “celebrate” RISC OS’s full “open source” by making a decision. The decision would be very simple – the game will work by November, or I’ll delete all of the files and forget about it.

My finger hovered over the delete option, because, there was a lot of work to do. But, you know me, there’s only so many DVDs I can watch… so I dragged the files into Zap, cranked up Eagle 80s (playing “China In Your Hand”, my favourite song of the decade, an omen?), and set about the long slog to getting this going.

Here are the results. The game has a lot of stuff still to do (it doesn’t support auto-win cases, and you always play first, for example), but it will start inviting you to play:

It’s a reduced size JPEG to be forum friendly. The real playing area is larger.

The point of the game is to match the flower cards (Hanafuda is Japanese for “flower cards”) by month to form winning combinations called “yaku”. From this, I can see Iris (third card on the bottom – that’s my “hand”) matches the upper right card on the table. The fourth card in my hand is a chrysanthemum which matches the second card on the top row. And the fifth card is a peony which matches the third card on the top row. The blue ribbons are worth ‘more’ than the red ribbon (three blue is a yaku). The cards the ribbons match with are plain flowers, so either one will suffice.

Here’s a little later on in the game:

I finally play the blue ribbon peony. You can see the third card on the upper row of the table is highlighted in yellow with a little version of the ribbon card on top. This means it has been “captured” (and once my turn is over will be sent to the part on the right). The topmost card on the stack has been turned over (because gameplay is a card from my hand and a card off the stack). It is highlighted blue as it is the card in play, and you can see three cards highlighted in red – this means they match the card in play. Since three cards are on the table, if I play that pampas grass card, I’ll claim the entire month.

Game play keeps on like this until a yaku is formed or you run out of cards in your hand. If you run out of cards, the game is a draw. If a yaku is formed, you have two choices. You can either decide to stop the game (in which case any points you have are yours), or you can Koi-Koi which means to carry on.
There is a benefit and a danger to this. The benefit is that the score will increase for every Koi-Koi. If it happens once, scores will double. If twice, they’ll triple. And so on. But the danger is that the person who stops the game will collect points. The other player gets nothing.

When somebody wins, the status window will pop up:

The part at the top says how many games played and who won. You see that insane score won by the computer? That’s because we had a brilliant game and kept on koi-koing. In the end, the computer brought things to a close on its final card and showed me an unbelievable score.

All that stuff down below is a record of what sorts of yaku were formed.

You will probably find this useful as an introduction to the game, an explanation of all the yaku, and a walk-through of a game:

https://www.heyrick.co.uk/blog/index.php?diary=20110729

Then once you’ve digested that, you can try the alpha-test version of the Koi-Koi game for RISC OS:

http://heyrick.ddns.net/files/koikoi20181103.zip (430K)
More rcent version available – see below

(this is all being served off my Pi, don’t expect miraculous speed! ☺)

Please post here how you get on. And note that even though the computer player is utterly braindead, it’s still a reasonable opponent! God help me if I give it some intelligence. Skynet anyone? ;-)

 
Nov 3, 2018 5:46pm
Avatar Steve Pampling (1551) 6782 posts

Not complaining that images aren’t there but:

but it will start inviting you to play:

Nope.

Here’s a little later on in the game:

Nope.

When somebody wins, the status window will pop up:

Nope.

 
Nov 3, 2018 6:30pm
Avatar GavinWraith (26) 1203 posts

I used to have a little box of hanafuda cards – lovely. They disappeared years ago in the clutter of my children’s childhood.

 
Nov 3, 2018 9:08pm
Avatar Rick Murray (539) 10812 posts

Steve – just switched to 3G and wandered around outside to get a signal (too flippin’ cold!) and the images showed up for me.

http://heyrick.ddns.net/files/koikoi1.jpeg
http://heyrick.ddns.net/files/koikoi2.jpeg
http://heyrick.ddns.net/files/koikoi3.png

Were you using a work computer or something that might block ddns?

Gavin – download the game, you can play with virtual cards. ;-)

 
Nov 3, 2018 9:37pm
Avatar Andrew Conroy (370) 626 posts

Steve – just switched to 3G and wandered around outside to get a signal (too flippin’ cold!) and the images showed up for me.

The images worked fine for me too.

 
Nov 3, 2018 9:49pm
Avatar Steve Pampling (1551) 6782 posts

just switched to 3G and wandered around outside to get a signal (too flippin’ cold!)

Nesh.

Were you using a work computer or something that might block ddns?

No, but if I were I’d have a short discussion with the network manager1 about how I could access any specific item.

As it happens coming back to this thread just now, the images all appear.

1 Short conversation with a full meeting of minds.

 
Nov 3, 2018 10:40pm
Avatar patric aristide (434) 427 posts

Looks interesting, thanks Rick! Love card games, Mahjong style puzzles and of course Sokoban (always sucked at shooters and everything else requiring hand-eye-coordination).

 
Nov 4, 2018 7:56am
Avatar Willard Goosey (5119) 237 posts

The game description makes my head hurt… but actually playing it is pretty easy… If only because the computer highlights the legal choices. :-)

It’s certainly a pretty card game!

 
Nov 4, 2018 9:22am
Avatar Colin Ferris (399) 1125 posts

Very nice – what about sending Rick some bully beef :-)

An ‘Auto’ mode – ie comp vs comp (done slowly to get a idea how it goes)

 
Nov 4, 2018 4:47pm
Avatar Rick Murray (539) 10812 posts

always sucked at shooters and everything else requiring hand-eye-coordination

Ditto. I have Resident Evil Codename Veronica for my PS2 and even with a walkthrough, I’ve yet to make it beyond the graveyard. For those unfamiliar with the game, that’s literally the second place you go after the opening that exists in order to allow you to find a gun…

The game description makes my head hurt…

It’s not that hard with practice. It’s basically a set of “match this with this”. Okay, it’s Japanese so it’s weird and complicated and several of the Animals aren’t, but asides from that it’s “match this with this (and this and this and maybe this but not this)”. ;-)

My advice – get the Sakê Cup and either the Full Moon or the Sakura Curtain. It’s the simplest (two card) yaku and it’s worth more than a single point.
But, at the same time as you try to get these, be sure not to let your opponent get them or anything else of value. There’s a reason you can see their capture area.

done slowly to get a idea how it goes

As Willard says, the legal choices are highlighted. So simply play it and note what works and what the computer opponent does (even though it isn’t by any means smart).

I have moved the pictures to my main website, so no waiting for my Pi to serve stuff (hi Steve!), and I have also created an update adding more features:

  • The game doesn’t start directly into a game. Click the icon when you’re ready to start.
  • At the very start, you must pick a card to determine if you go first or if the computer does. You need to pick the lowest month.
  • The person who goes first in subsequent games is the loser of the current game. If the game was a draw, then it’s the same person to go first.
  • Cards in the capture area are arranged more tidily than “in order of being added”. Brights are on the bottom line, Animals are on the third line, Ribbons are on the second line, and Plains are on the top line. They’re arranged from the right. If the allocated area fills up, they’ll overspill to the left of other lines.
    This has been done to make it easier for you to see what you have.

http://www.heyrick.co.uk/random/koikoi20181104.zip (~432K)

 
Nov 4, 2018 5:49pm
Avatar Steve Pampling (1551) 6782 posts

I have moved the pictures to my main website, so no waiting for my Pi to serve stuff (hi Steve!)

I’m glad you mentioned that, it caused me to think about slowness on forum pages loads, which I suspect could in some instances be related to the fetch from a third party site.

A number of people here use gravatar and response times from that setup are variable. So, slow forum response isn’t all local.

 
Nov 4, 2018 6:00pm
Avatar Rick Murray (539) 10812 posts

So, slow forum response isn’t all local.

It’s 2018. Any browser worth its salt ought to be capable of showing the forum content as it arrives, reflowing with images when they arrive. That said, there is something a little odd with the setup of this forum as my mobile browser prefers to show nothing at all until everything has been received (as opposed to drawing the textual content, then reflowing with images – just exactly at the moment you’re about to tap on something leading you to tap on something else…).

 
Nov 4, 2018 7:57pm
Avatar Willard Goosey (5119) 237 posts

Yay new version, will try after work.

 
Nov 9, 2018 8:10pm
Avatar Rick Murray (539) 10812 posts

New version! :-)

In a nutshell:

  • The pick-a-card and status windows use Desktop font rather than fugly VDU text.
  • Various tweaks not worth mentioning.
  • Computer player now picks a much better selection of cards to play. It’s no longer braindead, so prepare to have to concentrate hard on what cards to play!

http://heyrick.ddns.net/files/koikoi20181109.zip

Home server is off, will be out and warnings of thunderstorms. If you didn’t get the update, don’t worry – I’ve just finished several more improvements I’ll upload to heyrick this evening. ;-)
For us! the storm was something of a non event – it didn’t even blow the plastic cat bowl over…

PLEASE NOTE: This is being served off my home Pi, and we currently have the remnants of a storm blowing through, with thunderstorms forecast tomorrow. If there’s no reply, try again later. If something crappy happens like a tree taking out the phone line (been there, done that!), then I’ll post an update here via 3G mobile…

 
Nov 10, 2018 8:55pm
Avatar Willard Goosey (5119) 237 posts

1109 looked good and played good…

 
Nov 10, 2018 9:35pm
Avatar Rick Murray (539) 10812 posts

Thanks Willard. Here’s a new one (v0.02) with even more improved computer player. ;-)

https://www.heyrick.co.uk/blog/index.php?diary=20181110

 
Nov 11, 2018 3:18am
Avatar Willard Goosey (5119) 237 posts

The link to koikoi20181110.zip returns, and I quote:
“Whoa, dude, you’re like so totally 404!”

cute anime chick at least… :-)

 
Nov 11, 2018 8:10am
Avatar Rick Murray (539) 10812 posts

Oops, link should be fixed now…

 
Nov 11, 2018 8:49am
Avatar Willard Goosey (5119) 237 posts

Got it! Thanks!
Looks good!

 
Nov 13, 2018 8:20pm
Avatar Rick Murray (539) 10812 posts

Version 0.03 is now on !Store.

The differences are:

  • Updated the Help file.
  • Now (correctly!) closes the “pick a card” window when we’re done with it. [thanks Vince!]
 
Nov 14, 2018 11:45pm
Avatar Willard Goosey (5119) 237 posts

0.03 works fine for me!
I’m even holding even on “games won” with the lowest-level AI!

 
Oct 6, 2019 7:17am
Avatar Willard Goosey (5119) 237 posts

I could swear it was working earlier, but 0.04 SIGSEGV’s when the computer player wins a game(*), at address 8fb4 in arbitrator_donethat

(*)computer chooses “stop”.
points for game given.
crash.

RO 5.24, armv7 pi2, armv8 pi3

Reply

To post replies, please first log in.

Forums → General →

Search forums

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Description

General discussions.

Voices

  • Rick Murray (539)
  • Steve Pampling (1551)
  • GavinWraith (26)
  • Andrew Conroy (370)
  • patric aristide (434)
  • Willard Goosey (5119)
  • Colin Ferris (399)

Options

  • Forums
  • Login
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Beast theme is based on Beast's default layout

Valid XHTML 1.0  |  Valid CSS

Powered by Beast © 2006 Josh Goebel and Rick Olson
This site runs on Rails

Hosted by Arachsys