Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am taksuyu on github.
  • I am taksuyu (https://keybase.io/taksuyu) on keybase.
  • I have a public key whose fingerprint is 4203 F782 E8E2 2D58 F700 5F90 0349 1013 C1D8 2C8E

To claim this, I am signing this object:

Preface

I'll be going over many of the basics of Mahjong, but if you are looking for something visual and quick to get you up to speed I recommend http://www.japanesemahjong.com/reachmahjong/intro.htm as it does a good job explaining the basics. Quick note though, I use different names for the groups of tiles as those are how I learned them and many variants and cultures have different names and explanations. I could go over the history of the game and all the culture behind it, but I feel that is beyond the scope of this explanation.

@taksuyu
taksuyu / Tile.md
Last active October 2, 2015 04:53

Some basic properties of Tiles

  • They are separate by their type (Character, Circle, Bamboo, Wind, Dragon).
  • Simples (Character, Circle, Bamboo) will always have a number from 1 to 9 associated with them.
  • TNum, Wind, and Dragons are (basically) values that are associated with the suit and have the same properties, but different bounds.
-- | Basic functions of a Tile. Minimum completion is `honor` and `terminal`.
class Tileable a where
  suit :: a -> Bool
@taksuyu
taksuyu / learning-lens.md
Last active October 30, 2017 23:46
A list of material that helped me learn the lens package.

Learning Lens

I tend to focus on core concepts quite a bit more than actual examples, so that the fundamental understanding of what the examples are trying to teach me is building on skills I already have just haven't figured out how to use yet.

tl;dr Your mileage may vary. I learn kind of counterintuitively for others.

Since this seemed to be popular, I decided to make a repository for content about haskell topics that you can find here new materials for lens will be put here

.PHONY: MPD TEAMSPEAK clean
LIBMPDCLIENT_INCLUDEDIR = libmpdclient/include
LIBMPDCLIENT_HEADERDIR = $(LIBMPDCLIENT_INCLUDEDIR)/mpd
LIBMPDCLIENT_HEADERS := client.h async.h
LIBMPDCLIENT_OUTPUTDIR = src/mpd
TS3SDK_INCLUDEDIR = ts3_sdk/include
TS3SDK_HEADERDIR = $(TS3SDK_INCLUDEDIR)/teamspeak
TS3SDK_HEADERS := clientlib.h
-- | When dealing with multiple sets, you can have different
-- constraints. This can be observed in Mahjong where Suits will have
-- nine different values, but honors will vary. Wind and Dragon for
-- example have four and three values respectfully. They also don't
-- fit in with Bounded because these concepts exist together at the
-- same time and need to be handled differently. In many circumstances
-- you can define `minBoundBy` and `maxBoundBy` as just `minBound` and
-- `maxBound`.
class Bounded b => BoundedBy a b where
minBoundBy :: a -> b
@taksuyu
taksuyu / Default.hs
Created February 9, 2015 03:40
Hakyll almost default CSS in Clay
{-# LANGUAGE OverloadedStrings #-}
module Css.Default where
import Clay
import Prelude ()
defaultStyleSheet :: Css
defaultStyleSheet = do
body ? do
function :: x -> x
function x = x
intFunction :: Integer -> Integer
intFunction x = x
numFunction :: Num x => x -> x
numFunction x = x
addNumFunction :: Num x => x -> x -> x

You can get some interesting information with the use of MultiSets in haskell

This example is finding combinations of sequences with a given hand in mahjong. A more indepth explanation can be found here

runFilter $ MS.fromList
[ Suits Character One, Suits Character One, Suits Character One, Suits Character One
, Suits Character Two
, Suits Character Three
@taksuyu
taksuyu / shanten.md
Last active August 29, 2015 14:12
Rules around calculating Shanten for Japanese Riichi Mahjong

Shanten

Taking a hand (14 mahjong tiles) and figuring out the number of tiles you have to replace to have a winning hand.

This doesn't take account for the value, but just that a hand is in a winning state.

Tenpai is determined if a hand has a Shanten of 1.

Chiitoitsu (7 pairs)