“十点半”纸牌游戏/ConsoleApp1/Program.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public struct Poker
    {
        public string Sign;//纸牌符号 ♠ ♥ ♦ ♣
        public double Values;//纸牌数字
    }
    public struct Player
    {
        public string Name;//姓名
        public Poker[] Pokers;//玩家手中的纸牌
        public int PokerNums;//玩家手中的纸牌数量
    }
    class Program
    {
        //显示规则
        public static void ShowRule()
        {
            Console.WriteLine("游戏规则:");
            Console.WriteLine("1:两位游戏参与者,分别为电脑和玩家");
            Console.WriteLine("2:在游戏中,去除大小王,其中点数(J、Q、K)视为半点,其余视为与数字相同的点数。");
            Console.WriteLine("3:分别为电脑和玩家逐一发一张牌,作为底牌。");
            Console.WriteLine("4:每位玩家根据底牌,提出补牌申请,若接近十点半时,就该停止提出补牌申请。");
            Console.WriteLine("5:依序发牌给需要的人,每次一张。每人最多五张牌(含底牌)。");
            Console.WriteLine("6:当所有玩家都不需要进行补牌,则亮出所有玩家底牌,累计点数最接近十点半的玩家获得胜利。");
            Console.WriteLine();
        }
        //设置角色
        public static void SetRole(out Player player_A, out Player player_B)
        {
            //第一位玩家为用户
            Console.Write("请输入您的姓名:");
            player_A.Name = Console.ReadLine();
            player_A.Pokers = new Poker[5];//每位玩家最多5张牌
            player_A.PokerNums = 0;
            //第二位玩家为电脑
            player_B.Name = "小AI同学";
            player_B.Pokers = new Poker[5];//每位玩家最多5张牌
            player_B.PokerNums = 0;

            Console.WriteLine("用户玩家:" + player_A.Name);
            Console.WriteLine("电脑玩家:" + player_B.Name);
            Console.WriteLine();
        }
        //判断指定花色和点数的扑克牌是否存在
        public static bool IsExistsPoker(string sign, Poker[] pokers)
        {
            for (int i = 0; i < pokers.Length; i++)
            {
                if (pokers[i].Sign == sign)
                    return true;
            }
            return false;
        }
后面还有 176 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。