Java小游戏 —— 德州扑克

其实还是有一些错误的,很多功能懒得实现了,顺子方面我实现不来,好吧主要还是偷懒,仅供参考,java做扑克的视频b站有,不过具体实现要靠自己完成,上面只有怎么把符号和点数组合成一张牌

package Game;

public class Card implements Comparable{
	//花色
	private int suit;
	
	//点数
	private int rank;
	
	public Card() {
		super();
	}

	public Card(int suit, int rank) {
		super();
		this.suit = suit;
		this.rank = rank;
	}

	public int getSuit() {
		return suit;
	}

	public void setSuit(int suit) {
		this.suit = suit;
	}

	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}
	
	public String toString() {
		return App.SUITS[suit]+""+App.RANKS[rank];
	}
	
	public int compareTo(Object otherCard) {
		Card other = (Card)otherCard;
		return this.rank-other.getRank();
	}
}

package Game;
//工具类

public class App {
	//存放花色
	public static final String[] SUITS= {"♠","♥","♣","♦"};
	
	public static final String[] RANKS= {"2","3","4","5","6","7","8","9","10",
			"J","Q","K","A"};
	//红桃
	public static final int HEART = 0;
	//黑桃
	public static final int SPADE = 1;
	//梅花
	public static final int CLUB = 2;
	//方块
	public static final int DIAMOND = 3;
	
	//点数
	public static final int  TWO = 0;
	public static final int  THREE = 1;
	public static final int  FOUR = 2;
	public static final int  FIVE = 3;
	public static final int  SIX = 4;
	public static final int  SEVEN = 5;
	public static final int  EIGHT = 6;
	public static final int  NINE = 7;
	public static final int  TEN = 8;
	public static final int  JACK = 9;
	public static final int  QUEEN = 10;
	public static final int  KING = 11;
	public static final int  ACE = 12;
}

package Game;

import java.util.List;
import java.util.ArrayList;

/*
 * 玩家类
 * 
 */

public class Player {
	//名字
	private String name;
	//手牌,不清楚数量,用集合
	private List<Card> cards = new ArrayList<Card>();
	
	public Player(String name) {
		super();
		this.name = name;
	}
	public Player() {
		super();
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public List<Card> getCards() {
		return cards;
	}
	public void setCards(List<Card> cards) {
		this.cards = cards
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值