remove
powerd by nog twitter
 ホーム > ポーカー役判定

ポーカー役判定


ファイブカードドローポーカー、テキサスホールデム、オマハ、セブンスタッドの役判定ユーティリティです。
J2SE 5.0(1.5) 以上でないと動きません。
使い方は使用例や API ドキュメントをご覧ください。(JAR の中にソースも入っています)


ダウンロードslimePokerUtil20041121.jar

使用例
import java.util.*;

import slime.poker.Card;
import slime.poker.util.FiveCardDrawPlayer;
import slime.poker.util.FiveCardDrawRule;
import slime.poker.util.OmahaHoldemPlayer;
import slime.poker.util.OmahaHoldemRule;
import slime.poker.util.SevenCardStudPlayer;
import slime.poker.util.SevenCardStudRule;
import slime.poker.util.TexasHoldemPlayer;
import slime.poker.util.TexasHoldemRule;

public class PokerUtilTest {
    private PokerUtilTest() {
        printFiveCardDrawResult();
        printTexasHoldemResult();
        printOmahaHoldemResult();
        printSevenCardStudResult();
    }

    private void printFiveCardDrawResult() {
        final boolean useJoker = true;

        FiveCardDrawPlayer player = new FiveCardDrawPlayer(0, "Player1");
        FiveCardDrawRule rule = new FiveCardDrawRule(useJoker);

        player.setCards(Card.getRandomCards(FiveCardDrawRule.CARD_COUNT, useJoker));
        rule.judgeHand(player);

        System.out.println("ファイブカードドローポーカー");
        System.out.print(player.getHand() + "  ");
        for (Card.Rank rank : player.getHighCards()) {
            System.out.print(rank + " ");
        }
        System.out.println();
    }

    private void printTexasHoldemResult() {
        final boolean useJoker = false;

        TexasHoldemPlayer player = new TexasHoldemPlayer(0, "Player1");
        TexasHoldemRule rule = new TexasHoldemRule();

        player.setCards(Card.getRandomCards(TexasHoldemRule.CARD_COUNT, useJoker));
        rule.judgeHand(player);

        System.out.println("テキサスホールデム");
        System.out.print(player.getHand() + "  ");
        for (Card.Rank rank : player.getHighCards()) {
            System.out.print(rank + " ");
        }
        System.out.println();
    }

    private void printOmahaHoldemResult() {
        final boolean useJoker = false;

        OmahaHoldemPlayer player = new OmahaHoldemPlayer(0, "Player1");
        OmahaHoldemRule rule = new OmahaHoldemRule();

        player.setCards(Card.getRandomCards(OmahaHoldemRule.CARD_COUNT, useJoker));
        rule.judgeHand(player);

        System.out.println("オマハ");
        System.out.print(player.getHand() + "  ");
        for (Card.Rank rank : player.getHighCards()) {
            System.out.print(rank + " ");
        }
        System.out.println();
        if (rule.existLow(player)) {
            System.out.print("ロー  ");
            for (Card.Rank rank : player.getLowCards()) {
                System.out.print(rank + " ");
            }
            System.out.println();
        } else {
            System.out.println("ロー不成立");
        }
    }

    private void printSevenCardStudResult() {
        final boolean useJoker = false;

        SevenCardStudPlayer player = new SevenCardStudPlayer(0, "Player1");
        SevenCardStudRule rule = new SevenCardStudRule();

        player.setCards(Card.getRandomCards(SevenCardStudRule.CARD_COUNT, useJoker));
        rule.judgeHand(player);

        System.out.println("セブンスタッド");
        System.out.print(player.getHand() + "  ");
        for (Card.Rank rank : player.getHighCards()) {
            System.out.print(rank + " ");
        }
        System.out.println();
        if (rule.existLow(player)) {
            System.out.print("ロー  ");
            for (Card.Rank rank : player.getLowCards()) {
                System.out.print(rank + " ");
            }
            System.out.println();
        } else {
            System.out.println("ロー不成立");
        }
    }

    public static void main(String[] args) {
        new PokerUtilTest();
    }
}


API ドキュメント(Javadoc)