Get the top HN stories in your inbox every day.
codingdave
jasperry
If you rotate it so the board looks like the traditional solitaire layout, the direction of free tiles is horizontal as it's supposed to be. But then the images on the tiles are rotated 90 degrees. Either way you look at it, something is non-standard.
The other thing is that this implementation doesn't seem to support overlapping tiles, which is kind of important. For instance, the topmost tile should overlap and block all four tiles under it.
rofko
Thank you for the insight! I think rotating the tile images is key. Since I’m using CSS Grid for positioning, there are some limitations around overlap like the one you mentioned, but it should be solvable. I’ll keep working on it to bring it closer to the standard behavior.
omgmajk
Two games in a row now I have gotten to a point where the last two pieces are ontop of eachother. I think this is perfectly fine, but seems to happen a little too often. Or I was just very unlucky.
Otherwise it's a sweet game!
rpdillon
Thanks for mentioning this. I played a little bit and I felt like it was the opposite of what I'd remembered. I do like that the inaccessible tiles are faded somewhat so that I don't inadvertently try to match them.
undefined
rofko
Thank you for the feedback! I will triple check the rules
thih9
> Tiles are supposed to be free when there is a side free
No.
According to wikipedia[1]: "A tile is said to be open or exposed if it can be moved either left or right without disturbing other tiles.". Also look at the photo in the wikipedia article[2]. This implementation looks correct to me.
[1]: https://en.wikipedia.org/wiki/Mahjong_solitaire
[2]: https://en.wikipedia.org/wiki/Mahjong_solitaire#/media/File:...
Crestwave
A "free side" means being exposed on the left or right, matching your Wikipedia quote. On the other hand, OP's implementation checks if it can be moved up or down.
thih9
Look at the shape of the puzzle and compare with the wikipedia photo. The sides logic is correct.
Although looks like the images on the tiles were indeed rotated, as mentioned in another comment[1].
rdescartes
Should it be named Shanghai solitaire Or Mahjong Solitaire ?
gchamonlive
Maybe Mahjunk, am I right?
slowly lowers right hand in awkward silence
alexpotato
Coding + Mahjong related story:
Back in college, while majoring in CS, I had a rough time dealing with semicolons, typos, missed characters while coding.
I thought to myself "I wonder if playing Mahjong in the Windows games would help me get better at scanning code and finding these types of errors". So I tried it and, lo and behold, it did.
Also, in this day and age of LLMs writing a lot of the code, scanning for missing semicolons in code sounds like "I was great at fixing telegraphs!"
sanj
This is lovely! Can I suggest make sure that the board is solveable?
uean
This is part of the game. Many games will not be solvable.
Bender
I think this is a good example of what CSS can do and probably was not easy to make but I will likely stick with Mahjong that comes with most Linux distributions as they follow rules that people I may end up playing against would know and they have many layouts. I could see this being applied to other things however such as games that require building or repairing something. Or something similar to Minecraft?
Impressive work!
rafabulsing
Minecraft in CSS has been done, actually! https://benjaminaster.com/css-minecraft/
Discussion: https://news.ycombinator.com/item?id=44100148
Bender
Nice! No idea how I missed that one.
grougnax
When Doom in pure CSS ?
koolala
I wonder if versus Mahjong Solitaire could be like Battle Tetris. I've never heard of people playing it competitively.
haunter
Now make it _real_ mahjong (; https://en.wikipedia.org/wiki/Mahjong
Which makes me wonder which ruleset would be the easiest to implement. Probably MCR or HK, riichi has too many edge cases and sepcial rules and yakus.
snvzz
Riichi is the fun one, where skill weights over luck.
alexb_
Riichi is the most fun one, in my opinion, but I would not go so far as to say "skill weights over luck". The absolute best Riichi players win less than 25% of hands.
haunter
I also prefer riichi. Furiten is such a game changer, all other rulesets feel a bit less after that
whateveracct
Riichi is a good candidate for a video game due to all the specific rules. It has a lot of room for QoL. I have an app on my phone [1] that has made it fun to play and learn thanks to the guidance it has with the rules
[1] https://kemono.games/game/Kemono-Mahjong hunky furries aside, it's a really good single player Riichi app lol
snarf21
I design games and have been working on a Red Riichi variant where one of each number is red and this drives scoring instead of all the myriad of Yaku. All the Yaku are hard for beginners to onboard and a lot of hands have to good path to an interesting Yaku and just depend on luck to be able to call Riichi. I'm still testing it but I find it more interesting.
I also have a card game version that implements some of these ideas (although it doesn't have a Furiten concept).
koolala
I've been looking for a free one with really good helper UI to keep track of all the rules.
akersten
If I click fast enough on mobile it starts trying to select/highlight text, should be able to prevent that with CSS too. I find this is somehow a common issue that separates a lot of PWAs from real apps, the browser text engine is still lurking there in the background trying to recall us all to the glory days of hypermedia
koolala
Mahjong tiles are in Unicode so they could convert that functionality into accessibility information.
rofko
Thanks for the feedback! Just pushed that fix.
thenthenthen
There are some super weird bugs, sometimes only one of the two pieces are removed and sometimes the field goes blank? Also on every move the faves change?! iOS here. And yeah, no majiang, but still super cool! Nostalgic vibes waiting for my fries and playing the Photo Play touch screen gambling machine (after unlocking it by tapping the words photo and play on the logo with two different fingers and entering the code)
aranw
Really enjoyed that although my final two tiles were stacked and couldn't finish the game!
rofko
That's unfortunate! I'll make sure to patch that case.
Minor49er
This is pretty cool. I like the look and the gameplay. Though playing on mobile, some of the roatation gestures caused the page to refesh on me a couple of times since they triggered the browser's "drag down to refresh" interaction
rofko
Thanks for the report! I added a patch that hopefully fixes that.
DuncanCoffee
Nice! Wish the supported rotation was bigger, maybe +- 90 instead of only 90 deg?
snvzz
This ain't mahjong.
Instead, it is some solitaire using mahjong pieces.
socalgal2
Yea, pretty culturally insensive to call this "mahjong"
https://en.wikipedia.org/wiki/Mahjong
Beautifully made though.
What I liked about the first one I saw in the 80s was the cascading shadows. Admittedly they were more important for 2d version
koolala
Is mahjong using solitare pieces Rummy?
Get the top HN stories in your inbox every day.
It is a nice UX, but with a fatal flaw: Tiles are supposed to be free when there is a side free, but you instead have it coded to be free when the top or bottom is free. Your app, your rules, so if you intended to do that, cool. It is just a fundamental divergence from how other implementations do it.