test: [Mi麻雀] 一部を除く各種役のテスト (#13397)

* fix typo

* add letter-tiles tests

* add ippatsu test

* add tanyao and pinfu test

* fix ippatsu test

* add wind tests

* add iipeko and chitoitsu test

* add sanshoku-doujunn sanshoku-doo ittsu junchan tests

* add toitoi sananko test

* add ryanpeko test

* add honroto sankantsu honitsu chintisu tests

* add shosangen test
This commit is contained in:
im_tan 2024-02-19 16:51:56 +09:00 committed by GitHub
parent 4ae591a2c7
commit 0e27fa59d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,13 +18,495 @@ describe('Yaku', () => {
}); });
}); });
describe('white', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3'],
huros: [{type: 'pon', tile: 'haku'}],
tsumoTile: 'm3',
riichi: true,
}).includes('white'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3'],
huros: [{type: 'pon', tile: 'haku'}],
tsumoTile: 'm3',
riichi: false,
}), ['white']);
});
});
describe('red', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3'],
huros: [{type: 'pon', tile: 'chun'}],
tsumoTile: 'm3',
riichi: true,
}).includes('red'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3'],
huros: [{type: 'pon', tile: 'chun'}],
tsumoTile: 'm3',
riichi: false,
}), ['red']);
});
});
describe('green', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3'],
huros: [{type: 'pon', tile: 'hatsu'}],
tsumoTile: 'm3',
riichi: true,
}).includes('green'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3'],
huros: [{type: 'pon', tile: 'hatsu'}],
tsumoTile: 'm3',
riichi: false,
}), ['green']);
});
});
describe('field-wind', () => {
it('north', () => {
assert.deepStrictEqual(calcYakus({
house: 'n',
seat: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3', 'n', 'n', 'n'],
huros: [],
tsumoTile: 's',
}).includes('field-wind-n'), true);
});
it('east', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
seat: 'n',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3', 'e', 'e', 'e'],
huros: [],
tsumoTile: 'e',
}).includes('field-wind-e'), true);
});
it('south', () => {
assert.deepStrictEqual(calcYakus({
house: 's',
house: 'n',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3', 's', 's', 's'],
huros: [],
tsumoTile: 's',
}).includes('field-wind-s'), true);
});
it('west', () => {
assert.deepStrictEqual(calcYakus({
house: 'w',
house: 'n',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3', 'w', 'w', 'w'],
huros: [],
tsumoTile: 'w',
}).includes('field-wind-w'), true);
});
});
describe('seat-wind', () => {
it('north', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
seat: 'n',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3', 'n', 'n', 'n'],
huros: [],
ronTile: 's',
}).includes('seat-wind-n'), true);
});
it('east', () => {
assert.deepStrictEqual(calcYakus({
house: 's',
seat: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3', 'e', 'e', 'e'],
huros: [],
ronTile: 'e',
}).includes('seat-wind-e'), true);
});
it('south', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
house: 's',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3', 's', 's', 's'],
huros: [],
ronoTile: 's',
}).includes('seat-wind-s'), true);
});
it('west', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
house: 'w',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'm3', 'm3', 'w', 'w', 'w'],
huros: [],
ronTile: 'w',
}).includes('seat-wind-w'), true);
});
});
describe('ippatsu', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'n', 'n', 'n', 'm3', 'm3'],
huros: [],
riichi: true,
tsumoTile: 'm3',
ippatsu: true,
}).includes('ippatsu'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'n', 'n', 'n', 'm3', 'm3'],
huros: [],
riichi: true,
ronTile: 'm3',
ippatsu: true,
}).includes('ippatsu'), true);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p6', 'p6', 's6', 's7', 's8', 'n', 'n', 'n', 'm3', 'm3'],
huros: [],
tsumoTile: 'm3',
riichi: true,
}).includes('ippatsu'), false);
});
});
describe('tanyao', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm2', 'm2', 'p6', 'p7', 'p8', 's3', 's3', 's3', 's4', 's5', 's6', 'm3', 'm3'],
huros: [],
tsumoTile: 'm3',
}).includes('tanyao'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['p6', 'p7', 'p8', 's3', 's3', 's3', 's4', 's5', 's6', 'm3', 'm3'],
huros: [{type: 'pon', tile: 'm2'}],
tsumoTile: 'm3',
}).includes('tanyao'), true);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p6', 'p7', 'p8', 's3', 's3', 's3', 's4', 's5', 's6', 'm3', 'm3'],
ippatsu: true,
huros: [],
}).includes('tanyao'), false);
});
});
describe('pinfu', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'p6', 'p7', 'p8', 'p5', 'p6', 'p7', 's9', 's9', 's5', 's6', 's7'],
huros: [],
tsumoTile: 's7',
}).includes('pinfu'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'p6', 'p6', 'p6', 'p5', 'p6', 'p7', 's9', 's9', 's7', 's8', 's9'],
huros: [],
tsumoTile: 's9',
}).includes('pinfu'), false);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'p6', 'p6', 'p6', 'p5', 'p6', 'p7', 's9', 's9', 's5', 's6', 's7'],
huros: [],
tsumoTile: 's7',
}).includes('pinfu'), false);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'p6', 'p6', 'p6', 'p5', 'p6', 'p7', 's9', 's9', 's7', 's8', 's9'],
huros: [],
tsumoTile: 's7',
}).includes('pinfu'), false);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'p6', 'p7', 'p8', 'p5', 'p6', 'p7', 's9', 's9', 's5', 's6', 's7'],
huros: [],
ronTile: 's7',
}).includes('pinfu'), true);
});
});
describe('iipeko', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'm2', 'm3', 'm4', 'p5', 'p6', 'p7', 's9', 's9', 's4', 's5', 's6'],
huros: [],
tsumoTile: 's6',
}).includes('iipeko'), true);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'p5', 'p6', 'p7', 's9', 's9', 's4', 's5', 's6'],
huros: [{type: 'cii', tiles: ['m2','m3','m4']}],
riichi: true,
tsumoTile: 's6',
}).includes('iipeko'), false);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'm2', 'm3', 'm4', 'p5', 'p6', 'p7', 'p5', 'p6', 'p7', 'p1', 'p1'],
huros: [],
tsumoTile: 'p1',
}).includes('iipeko'), false);
});
});
describe('ryanpeko', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'm2', 'm3', 'm4', 'p5', 'p6', 'p7', 'p5', 'p6', 'p7', 'p1', 'p1'],
huros: [],
tsumoTile: 'p1',
}).includes('ryanpeko'), true);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 'm4', 'p5', 'p6', 'p7', 'p5', 'p6', 'p7', 'p1', 'p1'],
huros: [{type: 'cii', tiles: ['m2','m3','m4']}],
tsumoTile: 'p1',
}).includes('ryanpeko'), true);
});
});
describe('sanshoku-dojun', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 'p1', 'p2', 'p3', 's1', 's2', 's3', 'n', 'n', 'n', 'm3', 'm3'],
huros: [],
tsumoTile: 'm3',
}).includes('sanshoku-dojun'), true);
});
});
describe('sanshoku-doko', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm2', 'm2', 'p2', 'p2', 'p2', 's2', 's2', 's2', 'n', 'n', 'n', 'm3', 'm3'],
huros: [],
tsumoTile: 'm3',
}).includes('sanshoku-doko'), true);
});
});
describe('ittsu', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 'm3', 'm3'],
huros: [],
tsumoTile: 'm3',
}).includes('ittsu'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm3', 'm4', 's4', 's5', 's6', 's7', 's8', 's9', 'm3', 'm3'],
huros: [{type: 'cii', tiles:['s1', 's2', 's3']}],
tsumoTile: 'm3',
}).includes('ittsu'), true);
});
});
describe('chanta', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 's1', 's2', 's3', 's7', 's8', 's9', 'p7', 'p8', 'p9', 'haku', 'haku'],
huros: [],
tsumoTile: 'haku',
}).includes('chanta'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 's1', 's2', 's3', 's7', 's8', 's9', 'haku', 'haku'],
huros: [{type: 'pon', tile : 'p9'}],
tsumoTile: 'haku',
}).includes('chanta'), true);
});
});
describe('junchan', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 's1', 's2', 's3', 's7', 's8', 's9', 'p7', 'p8', 'p9', 'm9', 'm9'],
huros: [],
tsumoTile: 'm9',
}).includes('junchan'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm2', 'm3', 's1', 's2', 's3', 's7', 's8', 's9', 'm9', 'm9'],
huros: [{type: 'pon', tile : 'p9'}],
tsumoTile: 'm9',
}).includes('junchan'), true);
});
});
describe('chitoitsu', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm2', 'm2', 'm8', 'm8', 'p5', 'p5', 'p7', 's7', 's9', 's9', 'p2', 'p2'],
huros: [],
tsumoTile: 'p2',
}).includes('chitoitsu'), true);
});
});
describe('toitoi', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'p5', 'p5', 'p5', 's7', 's7', 's7', 'p2', 'p2'],
huros: [],
tsumoTile: 'p2',
}).includes('toitoi'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m2', 'm2', 'm2', 'p5', 'p5', 'p5', 's7', 's7', 's7', 'p2', 'p2'],
huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 'p2',
}).includes('toitoi'), true);
});
});
describe('sananko', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'p5', 'p5', 'p5', 's7', 's8', 's9', 'p2', 'p2'],
huros: [],
tsumoTile: 'p2',
}).includes('sananko'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'p5', 'p5', 'p5', 's7', 's7', 's7', 'p2', 'p2'],
huros: [{type: 'ankan', tile: 'm2'}],
tsumoTile: 'p2',
}).includes('sananko'), true);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'p5', 'p5', 'p5', 's7', 's8', 's9', 'p2', 'p2'],
huros: [{type: 'minkan', tile: 'm2'}],
tsumoTile: 'p2',
}).includes('sananko'), false);
});
});
describe('honroto', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm9', 'm9', 'm9', 'p9', 'p9', 'p9', 'hatsu', 'hatsu', 'hatsu', 'n', 'n'],
huros: [],
tsumoTile: 'n',
}).includes('toitoi'), true);
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m9', 'm9', 'm9', 'p9', 'p9', 'p9', 'hatsu', 'hatsu', 'hatsu', 'n', 'n'],
huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 'p2',
}).includes('toitoi'), true);
});
});
describe('sankantsu', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m9', 'm9', 'm9', 'n', 'n'],
huros: [[{type: 'ankan', tile: 'm1'}, {type: 'ankan', tile: 'm2'}, {type: 'minkan', tile: 'm3'}]],
tsumoTile: 'p2',
}).includes('sankantsu'), true);
});
});
describe('honitsu', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm5', 'm6', 'm7', 'm9', 'm9', 'm9', 'n', 'n'],
huros: [],
tsumoTile: 'n',
}).includes('honitsu'), true);
});
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm5', 'm6', 'm7', 'm9', 'm9', 'm9', 'm8', 'm8'],
huros: [],
tsumoTile: 'm8',
}).includes('honitsu'), false);
});
});
describe('chinitsu', () => {
it('invalid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm5', 'm6', 'm7', 'm9', 'm9', 'm9', 'm8', 'm8'],
huros: [],
tsumoTile: 'm8',
}).includes('chinitsu'), true);
});
});
describe('shosangen', () => {
it('valid', () => {
assert.deepStrictEqual(calcYakus({
house: 'e',
handTiles: ['haku', 'haku', 'haku', 'chun', 'chun', 'hatsu', 'hatsu', 'hatsu', 'm1', 'm1', 'm1', 'm2', 'm2', 'm2'] ,
huros: [],
tsumoTile: 'm2',
}).includes('shosangen'), true);
});
});
describe('kokushi', () => { describe('kokushi', () => {
it('valid', () => { it('valid', () => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: 'e', house: 'e',
handTiles: ['m1', 'm1', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm9'] , handTiles: ['m1', 'm1', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm9'] ,
huros: [], huros: [],
tumoTiles: 'm9', tsumoTile: 'm9',
}), ['kokushi']); }), ['kokushi']);
}); });
@ -33,7 +515,7 @@ describe('Yaku', () => {
house: 'e', house: 'e',
handTiles: ['m1', 'm9', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm3'] , handTiles: ['m1', 'm9', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm3'] ,
huros: [], huros: [],
tumoTiles: 'm3', tsumoTile: 'm3',
}).includes('kokushi'), false); }).includes('kokushi'), false);
}); });
}); });
@ -44,7 +526,7 @@ describe('Yaku', () => {
house: 'e', house: 'e',
handTiles: ['m1', 'm9', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm1'] , handTiles: ['m1', 'm9', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm1'] ,
huros: [], huros: [],
tumoTiles: 'm1', tsumoTile: 'm1',
}), ['kokushi-13']); }), ['kokushi-13']);
}); });
@ -53,7 +535,7 @@ describe('Yaku', () => {
house: 'e', house: 'e',
handTiles: ['m1', 'm1', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm9'] , handTiles: ['m1', 'm1', 's1', 's9', 'p1', 'p9', 'haku', 'hatsu', 'chun', 'n', 'w', 's', 'e', 'm9'] ,
huros: [], huros: [],
tumoTiles: 'm1', tsumoTile: 'm1',
}).includes('kokushi-13'), false); }).includes('kokushi-13'), false);
}); });
}); });
@ -61,36 +543,36 @@ describe('Yaku', () => {
describe('suanko', () => { describe('suanko', () => {
it('valid',() => { it('valid',() => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'], handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'],
huros: [], huros: [],
tsumoTile: 'chun', tsumoTile: 'chun',
}), ['suanko']); }), ['suanko']);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'], handTiles: ['m2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'],
huros: [{type: 'ankan', :tile: 'm1'}], huros: [{type: 'ankan', tile: 'm1'}],
tsumoTile: 'chun', tsumoTile: 'chun',
}), ['suanko']); }), ['suanko']);
}); });
it('invalid',() => { it('invalid',() => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'], handTiles: ['hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'],
huros: [{type: 'pom', tile: 'm1'}], huros: [{type: 'pon', tile: 'm1'}],
ronTile: 'e', ronTile: 'e',
}).includes('suanko'), false); }).includes('suanko'), false);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'], handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'],
huros: [], huros: [],
ronTile: 'e', ronTile: 'e',
}).includes('suanko'), false); }).includes('suanko'), false);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'], handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'm2', 'm2', 'e', 'e', 'e'],
huros: [], huros: [],
ronTile: 'e', ronTile: 'e',
@ -101,13 +583,13 @@ describe('Yaku', () => {
describe('suanko-tanki', () => { describe('suanko-tanki', () => {
it('valid', () =>{ it('valid', () =>{
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'm3', 'm3', 'm3', 'haku', 'haku', 'haku', 'e', 'e'], handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'm3', 'm3', 'm3', 'haku', 'haku', 'haku', 'e', 'e'],
huros: [], huros: [],
tsumoTile: 'e', tsumoTile: 'e',
}), ['suanko-tanki']); }), ['suanko-tanki']);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m2', 'm2', 'm2', 'm3', 'm3', 'm3', 'haku', 'haku', 'haku', 'e', 'e'], handTiles: ['m2', 'm2', 'm2', 'm3', 'm3', 'm3', 'haku', 'haku', 'haku', 'e', 'e'],
huros: [{type: 'ankan', tile: 'm1'}], huros: [{type: 'ankan', tile: 'm1'}],
tsumoTile: 'e', tsumoTile: 'e',
@ -116,7 +598,7 @@ describe('Yaku', () => {
it('invalid', () => { it('invalid', () => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'], handTiles: ['m1', 'm1', 'm1', 'm2', 'm2', 'm2', 'hatsu', 'hatsu', 'hatsu', 'chun', 'chun', 'chun', 'e', 'e'],
huros: [], huros: [],
tsumoTile: 'chun', tsumoTile: 'chun',
@ -146,7 +628,7 @@ describe('Yaku', () => {
house: 'e', house: 'e',
handTiles: ['haku', 'haku', 'haku', 'chun', 'chun', 'hatsu', 'hatsu', 'hatsu', 'm1', 'm1', 'm1', 'm2', 'm2', 'm2'] , handTiles: ['haku', 'haku', 'haku', 'chun', 'chun', 'hatsu', 'hatsu', 'hatsu', 'm1', 'm1', 'm1', 'm2', 'm2', 'm2'] ,
huros: [], huros: [],
tumoTiles: 'm2', tsumoTile: 'm2',
}).includes('daisangen'), false); }).includes('daisangen'), false);
}); });
}); });
@ -154,13 +636,13 @@ describe('Yaku', () => {
describe('tsuiso', () => { describe('tsuiso', () => {
it('valid', () =>{ it('valid', () =>{
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['haku', 'haku', 'haku', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['haku', 'haku', 'haku', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [], huros: [],
tsumoTile: 's', tsumoTile: 's',
}), ['tsuiso']); }), ['tsuiso']);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'haku'}], huros: [{type: 'pon', tile: 'haku'}],
tsumoTile: 's', tsumoTile: 's',
@ -169,14 +651,14 @@ describe('Yaku', () => {
it('invalid', () => { it('invalid', () => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [], huros: [],
tsumoTile: 's', tsumoTile: 's',
}).includes('tsuiso'), false); }).includes('tsuiso'), false);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'm1'}], huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 's', tsumoTile: 's',
@ -187,13 +669,13 @@ describe('Yaku', () => {
describe('shosushi', () => { describe('shosushi', () => {
it('valid', () =>{ it('valid', () =>{
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [], huros: [],
tsumoTile: 's', tsumoTile: 's',
}), ['shosushi']); }), ['shosushi']);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'w', 'w', 'w', 's', 's'], handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'e'}], huros: [{type: 'pon', tile: 'e'}],
tsumoTile: 's', tsumoTile: 's',
@ -202,14 +684,14 @@ describe('Yaku', () => {
it('invalid', () => { it('invalid', () => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['m1', 'm1', 'm1', 'hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [], huros: [],
tsumoTile: 's', tsumoTile: 's',
}).includes('shosushi'), false); }).includes('shosushi'), false);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'm1'}], huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 's', tsumoTile: 's',
@ -220,13 +702,13 @@ describe('Yaku', () => {
describe('daisushi', () => { describe('daisushi', () => {
it('valid', () =>{ it('valid', () =>{
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's', 's'], handTiles: ['m1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's', 's'],
huros: [], huros: [],
tsumoTile: 's', tsumoTile: 's',
}), ['daisushi']); }), ['daisushi']);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'n', 'n', 'n', 'w', 'w', 'w', 's', 's', 's'], handTiles: ['m1', 'm1', 'n', 'n', 'n', 'w', 'w', 'w', 's', 's', 's'],
huros: [{type: 'pon', tile: 'e'}], huros: [{type: 'pon', tile: 'e'}],
tsumoTile: 'e', tsumoTile: 'e',
@ -235,14 +717,14 @@ describe('Yaku', () => {
it('invalid', () => { it('invalid', () => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['m1', 'm1', 'm1', 'n', 'n', 'n', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [], huros: [],
tsumoTile: 's', tsumoTile: 's',
}).includes('daisushi'), false); }).includes('daisushi'), false);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'], handTiles: ['hatsu', 'hatsu', 'hatsu', 'e', 'e', 'e', 'w', 'w', 'w', 's', 's'],
huros: [{type: 'pon', tile: 'm1'}], huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 'e', tsumoTile: 'e',
@ -253,13 +735,13 @@ describe('Yaku', () => {
describe('ryuiso', () => { describe('ryuiso', () => {
it('valid', () =>{ it('valid', () =>{
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's4', 's6', 's6', 's6', 's8', 's8', 's8', 'hatsu', 'hatsu'], handTiles: ['s2', 's2', 's2', 's2', 's3', 's4', 's6', 's6', 's6', 's8', 's8', 's8', 'hatsu', 'hatsu'],
huros: [], huros: [],
tsumoTile: 'hatsu', tsumoTile: 'hatsu',
}), ['ryuiso']); }), ['ryuiso']);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8'], handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8'],
huros: [{type: 'pon', tile: 'hatsu'}], huros: [{type: 'pon', tile: 'hatsu'}],
tsumoTile: 's8', tsumoTile: 's8',
@ -268,13 +750,13 @@ describe('Yaku', () => {
it('invalid', () => { it('invalid', () => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8','haku','haku','haku'], handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8','haku','haku','haku'],
huros: [], huros: [],
tsumoTile: 's', tsumoTile: 's',
}).includes('ryuiso'), false); }).includes('ryuiso'), false);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8'], handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8'],
huros: [{type: 'pon', tile: 'haku'}], huros: [{type: 'pon', tile: 'haku'}],
tsumoTile: 's', tsumoTile: 's',
@ -285,13 +767,13 @@ describe('Yaku', () => {
describe('chinroto', () => { describe('chinroto', () => {
it('valid', () =>{ it('valid', () =>{
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m1','m1','m1''m9', 'm9', 'm9', 's1', 's1', 's1', 's9', 's9', 's9', 'p1', 'p1'], handTiles: ['m1','m1','m1''m9', 'm9', 'm9', 's1', 's1', 's1', 's9', 's9', 's9', 'p1', 'p1'],
huros: [], huros: [],
tsumoTile: 'p1', tsumoTile: 'p1',
}), ['chinroto']); }), ['chinroto']);
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['m9', 'm9', 'm9', 's1', 's1', 's1', 's9', 's9', 's9', 'p1', 'p1'], handTiles: ['m9', 'm9', 'm9', 's1', 's1', 's1', 's9', 's9', 's9', 'p1', 'p1'],
huros: [{type: 'pon', tile: 'm1'}], huros: [{type: 'pon', tile: 'm1'}],
tsumoTile: 'p1', tsumoTile: 'p1',
@ -300,7 +782,7 @@ describe('Yaku', () => {
it('invalid', () => { it('invalid', () => {
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8','haku','haku','haku'], handTiles: ['s2', 's2', 's2', 's2', 's3', 's3', 's3', 's3', 's4', 's8', 's8','haku','haku','haku'],
huros: [], huros: [],
tsumoTile: 's', tsumoTile: 's',
@ -311,7 +793,7 @@ describe('Yaku', () => {
describe('sukantsu', () => { describe('sukantsu', () => {
it('valid', () =>{ it('valid', () =>{
assert.deepStrictEqual(calcYakus({ assert.deepStrictEqual(calcYakus({
house: '', house: 'e',
handTiles: ['p1', 'p1'], handTiles: ['p1', 'p1'],
huros: [{type: 'ankan', tile: 'm1'}, {type: 'ankan', tile: 'm2'}, {type: 'minkan', tile: 'm3'}, {type: 'minkan', tile: 'chun'}], huros: [{type: 'ankan', tile: 'm1'}, {type: 'ankan', tile: 'm2'}, {type: 'minkan', tile: 'm3'}, {type: 'minkan', tile: 'chun'}],
tsumoTile: 'p1', tsumoTile: 'p1',