Mahjong programming tests: Difference between revisions

From Japanese Mahjong Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 69: Line 69:


13, 17, 29: 6-shanten. Mostly crap, 6 terminals, 1 protogroup, no pair. (14 tiles start)
13, 17, 29: 6-shanten. Mostly crap, 6 terminals, 1 protogroup, no pair. (14 tiles start)
[[Category:Mahjong algorithms]]

Revision as of 22:21, 13 April 2015

Every programmer who has previously tackled attempting to test and verify the veracity of his functions should at one point have attempted to run a set of tests. The purpose of a test is to obtain a series of valid results from a program, in order to verify the validity of the function meant to return values. A tell-tale pattern may be included for rapid verification (true, false, true, false, ...).

Shanten tests

The following tests should work and provide results with an ever decreasing shanten, until a block change occurs. The tests below should provide a series of tests where the shanten count goes down from 6 to 0 three times, -1 _____ times and 0 _____ times.

Currently (2015.04.11@1830 UTC): 6,5,4,3,2,1,0,6,5,4,3,2,1,0,6,5,6.

Tile formats are offered in string arrays and MPSZ format.

String array MPSZ format
"7,17,29,41,53,67,77,89,101,111,113,117,127"
"7,11,29,41,53,67,71,89,101,111,113,115,127"
"7,11,31,33,53,57,73,79,101,105,115,117,127"
"9,11,31,33,53,57,73,79,101,105,115,117,127"
"9,10,11,53,57,73,79,101,105,115,125,127,135"
"8,10,11,53,57,60,73,79,101,105,115,125,127"
"8,9,10,53,57,60,73,79,98,101,105,125,127"
"6,17,35,37,53,71,77,89,101,111,113,117,127"
"6,17,34,37,53,71,72,89,101,111,113,117,127"
"6,17,33,37,53,71,72,101,111,113,117,118,127"
"3,17,33,37,53,71,72,101,111,113,117,118,127"
"3,32,33,37,53,71,72,106,111,113,117,118,127"
"3,32,34,37,68,71,88,91,111,113,117,118,127"
"2,32,34,68,71,88,91,112,113,117,118,124,127"
"1,6,9,41,53,67,77,89,101,111,113,117,127"
"1,2,3,41,53,67,77,89,101,111,113,117,127"

"13,17,29,37,53,67,73,89,101,111,113,117,127,135"
"258m258p258s1235z"
"238m2589p58s1225z"
"2389m56p1289s235z"
"3389m56p1289s235z"
"333m56p1289s2557z"
"333m567p1289s255z"
"333m567p12789s55z"
"259m159p258s1235z"
"259m159p158s1235z"
"259m159p18s12335z"
"159m159p18s12335z"
"199m159p19s12335z"
"199m199p55s12335z"
"199m99p55s223355z"
"123m258p258s1235z"
"111m258p258s1235z"

"458m158p158s12357z"


Elements tested

7, 17, 29: 6-shanten. All crap, 4 terminals.
7, 11, 29: 5-shanten. 3 protogroups, 5 terminals.
7, 11, 31: 4-shanten. 5 protogroups without pair.
9, 11, 31: 3-shanten. 5 protogroups including a pair.
9, 10, 11: 2-shanten. 1 group, 4 protogroups including a pair.
8, 10, 11: 1-shanten. 2 groups, 3 protogroups including a pair.
8, 9, 10: Tenpai (0-shanten). 3 groups, 2 protogroups including a pair.
6, 17, 35: 6-shanten. All crap, 7 different terminals (no pair).
6, 17, 34: 5-shanten. All crap, 8 different terminals (no pair).
6, 17, 33: 4-shanten. All crap, 8 different terminals, one terminal pair.
3, 17, 33: 3-shanten. All crap, 9 different terminals, one terminal pair. (13-10)
3, 32, 33: 2-shanten. All crap, 10 different terminals, two terminal pairs. (13-11)
3, 32, 34: 1-shanten. 5 pairs, no groups.
2, 32, 34: Tenpai (0-shanten). 6 pairs.
1, 6, 9: 6-shanten. One group (sequence), rest crap.
1, 2, 3: 5-shanten. One group (triplet), rest crap (pair present obv.).

13, 17, 29: 6-shanten. Mostly crap, 6 terminals, 1 protogroup, no pair. (14 tiles start)