和了型の判定方法

麻雀の和了か否かを判定する方法です
手牌インスタンスを生成することで判定します

手牌インスタンス作成

手牌インスタンスの作成はMahjongHandsクラスをnewします
必要なパラメータはどのコンストラクタを使うかによります
詳しくは手牌クラスの説明をご覧ください

int[] tiles = {
            3, 0, 0, 0, 0, 0, 0, 0, 3,
            0, 0, 0, 0, 0, 0, 0, 0, 3,
            0, 0, 2, 0, 0, 0, 0, 0, 3,
            0, 0, 0, 0,
            0, 0, 0
        };
        MahjongTile last = MahjongTile.M6;
        hands = new MahjongHands(tiles, last);
        if (hands.getCanWin()) {
            System.out.println("和了の形です");
        } else {
          System.out.println("和了の形ではありません");
        }
int[] otherTiles = {
            0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 1, 1, 1, 0,
            2, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0,
            0, 0, 0
        };

        MahjongTile tile = P7;
        Kotsu mentsu1 = new Kotsu(false, S2);
        Shuntsu mentsu2 = new Shuntsu(true, M7);
        Kantsu mentsu3 = new Kantsu(false, SHA);
        hands = new MahjongHands(otherTiles, tile, mentsu1, mentsu2, mentsu3);
        if (hands.getCanWin()) {
            System.out.println("和了の形です");
        } else {
          System.out.println("和了の形ではありません");
        }
int[] otherTiles = {
            0, 0, 1, 1, 1, 0, 0, 0, 0,
            0, 0, 1, 1, 1, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0,
            2, 0, 0, 0,
            0, 0, 0
        };
        List<MahjongMentsu> mentsuList = new ArrayList<>(2);
        mentsuList.add(new Kotsu(true, P4));
        mentsuList.add(new Kantsu(true, CHN));

        hands = new MahjongHands(otherTiles, TON, mentsuList);
        if (hands.getCanWin()) {
          System.out.println("和了の形です");
        } else {
          System.out.println("和了の形ではありません");
        }

3つ全ての出力は

和了の形です

となります