QuickMatch
Rules 
of QuickMatch
QuickMatch can be played 
as per 
the following 
rules:
n  
It is a 
multi-player 
game. There 
can be 2 
to 4 players.
n  
Each player 
is given 
a set 
of five 
cards. 
The remaining 
cards are 
kept 
in a 
pile 
at the center.
n  
The player 
can either 
draw 
a card 
from the 
pile 
of cards 
or pick 
a card, 
which 
is thrown 
by 
another 
player.
n  
The first 
player 
to collect five cards of 
the same suite 
wins the game.
Instant play,download the game : click here
Design Specifications
The design of 
the game should be 
as per 
the following 
specifications:
n  
It is 
a multi-player 
game. 
The number 
of players 
that 
can play 
the game 
can be 2 
to 4.
n  
The name of each player 
is accepted 
from 
the user 
before starting 
the game.
n  
The cards 
are 
distributed 
to the 
players 
randomly. 
The remaining 
cards are 
kept in 
a pile at the 
center.
n  
The player 
whose name is entered 
first 
gets the first 
chance.
n  
Other 
players get 
the chance in 
the sequence 
in which 
their 
names were 
entered.
n  
The first 
player 
needs to pick 
the topmost card from 
the pile.
n  
The card picked by the player 
gets added to his/her 
card 
collection. When a 
new card is 
added in 
the 
player’s 
card 
collection, 
the 
total 
number 
of cards 
in the 
collection exceeds 
five. 
Therefore, 
the 
player 
needs to 
discard 
a card 
from his/her 
collection and place 
it upturned so 
that 
the other players can see the card.
n  
After 
the 
first 
player 
discards 
the card, 
the 
next player 
gets 
the chance 
to pick 
a card.
All 
players 
except 
the first 
player can 
either 
pick a 
card from 
the pile 
or pick 
the card that the previous 
player has discarded.
n  
After 
a player 
discards 
a card, 
the 
player’s 
collection 
of cards 
should 
be checked 
to determine whether 
all cards 
belong to 
the same suite.
C# Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication9
{
    class user
    {
        public string name;
        public int[] cards=new int[5];
    }
    class Program
    {
        static string[] cardspack = new string[52];
        static bool[] flag = new bool[52];
        static int getcard()
        {
            int nn;
            Random r = new Random();
            while(true)
            {
            nn = (r.Next() % 52);
            if (flag[nn] == false)
                break;
            }
            flag[nn] = true;
             return nn;       
        }
        static void init()
        {
            for (int i = 0, j = 2; i < 52; i++)
            {
                flag[i] = false;
                string msg = "The ";
                if (i % 13 == 0)
                {
                    msg += "king ";
                    j = 2;
                }
                else if ((i - 1) % 13 == 0)
                    msg += "queen ";
                else if ((i - 2) % 13 == 0)
                    msg += "jack ";
                else if ((i - 3) % 13 == 0)
                    msg += "ace ";
                else
                {
                    msg += j.ToString() + " ";
                    j++;
                }
                if (i < 13)
                    msg += "spades ";
                else if (i < 26)
                    msg += "hearts ";
                else if (i < 39)
                    msg += "clubs ";
                else
                    msg += "diamonds ";
                cardspack[i] = msg;
                //Console.WriteLine(cardspack[i]+"  "+flag[i]);
            }
        }
        static void wait()
        {
            Console.ForegroundColor = ConsoleColor.Black;
            for (long i = 0; i < 1000; i++)
            {
                for (long ii = 0; ii < 10; ii++)
                {
                    Console.BackgroundColor = ConsoleColor.White;
                    Console.Write("10101000010000");
                } 
                for (long ii = 0; ii < 10; ii++)
                {
                    Console.BackgroundColor = ConsoleColor.Red;
                    Console.Write("10101000010000");
                } 
                }
            Console.Clear();
        }
        static int check(user u)
        {
            if (u.cards[0] < 13 && u.cards[1] < 13 && u.cards[2] < 13 && u.cards[3] < 13 && u.cards[4] < 13)
            {
                Console.BackgroundColor = ConsoleColor.Green;
                Console.Clear();
                Console.WriteLine("\n\n\n\n\t\t\t"+u.name+" WINS!!!!!!!!!!!!");
                return 1;
            }
            else if (u.cards[0] > 12 && u.cards[1] > 12 && u.cards[2] > 12 && u.cards[3] > 12 && u.cards[4] > 12 && u.cards[0] < 26 && u.cards[1] < 26 && u.cards[2] < 26 && u.cards[3] < 26 && u.cards[4] < 26)
            {
                Console.BackgroundColor = ConsoleColor.Green;
                Console.Clear();
                Console.WriteLine("\n\n\n\n\t\t\t"+u.name+" WINS!!!!!!!!!!!!");
                return 1;
            }
            else if (u.cards[0] > 25 && u.cards[1] > 25 && u.cards[2] > 25 && u.cards[3] > 25 && u.cards[4] > 25 && u.cards[0] < 39 && u.cards[1] < 39 && u.cards[2] < 39 && u.cards[3] < 39 && u.cards[4] < 39)
            {
                Console.BackgroundColor = ConsoleColor.Green;
                Console.Clear();
                Console.WriteLine("\n\n\n\n\t\t\t"+u.name+" WINS!!!!!!!!!!!!");
                return 1;
            }
            else if (u.cards[0] > 38 && u.cards[1] > 38 && u.cards[2] > 38 && u.cards[3] > 38 && u.cards[4] > 38)
            { 
                Console.BackgroundColor = ConsoleColor.Green;
                Console.Clear();
                Console.WriteLine("\n\n\n\n\t\t\t"+u.name+" WINS!!!!!!!!!!!!");
                return 1;
            }
        else
                return 0;
        }
        static void Main(string[] args)
        {
            Console.Title = "Vadivelan Udayakumar";
            wait();
            Console.CursorVisible = false;
            Console.BackgroundColor = ConsoleColor.Gray;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("\n\n\n\n\n\n\n\n\n\t\t\t\tWelcome!!!!!!!!!\t\t\t\t");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\n\n\t\t\t     Quick Match-Cards Game\t\t\t\t\t");
            Console.WriteLine("\n\n\t\t\t\t  Press any key\t\t\t\t\t");
            Console.ReadLine();
            wait();
            init();
            Console.BackgroundColor = ConsoleColor.White;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Black;
            Console.WriteLine("\n\n\t\t\tQuick Match:::\n\n\tAbout game:\n\n\t * It is a multi-player game, there can be 2 to 4 players.\n\n\t * Each player is given a set of five cards.\n\n\t * The remaining cards are kept in a pile at the center.\n\n\t * The player can either draw a card from the pile of cards or pick a \n\t   card, which is thrown by another player.\n\n\t * The first player to collect five cards of the same suite wins the \n\t   game.\n\n\n\n\t\tPRESS ANY KEY TO START.....");
            Console.ReadLine();
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Clear();
            Console.Title = "..............Quick Match...............By, Vadivelan.U and Parthiban.S";
            Console.CursorVisible = true;
            Console.Write("\n\n\tEnter the Number of players (Integer value):\n\n\t");
            int n = Convert.ToInt16(Console.ReadLine());
            user[] u = new user[n];
            Console.Clear();
            for (int i = 0; i < n; i++)
            {
                u[i] = new user();
                Console.Write("\n\n\t\t\tEnter player" + (i + 1) + "'s name (String Value): \n\n\t\t\t");
                u[i].name=Console.ReadLine();
                Console.Write("\n\n\n\t\t\tYour cards are:\n");
                for (int j = 0; j < 5;)
                {
                        int nn=getcard();               
                        u[i].cards[j] = nn;
                        j++;
                        Console.Write("\n\n\t\t\t" + cardspack[nn]);
                }
                Console.WriteLine("\n\n\t\t\tPress any key..");
                Console.ReadKey();
                Console.Clear();
            }
            wait();
            Console.WriteLine("Lets Start the game:");
            int left=-1;
            for (int i = 0; ;i++)
            {
                if (i % 2 == 0)
                {
                    Console.BackgroundColor = ConsoleColor.White;
                    Console.Clear();
                    Console.ForegroundColor = ConsoleColor.Black;
                }
                else
                    {
                        Console.BackgroundColor = ConsoleColor.Blue;
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.Black;
                    }
                Console.Title = "\n\t\tPlay : " + u[i].name;
                Console.WriteLine("\n\n\t\t" + u[i].name + "'s turn\n\n\t\tYour Cards are:");
                for (int j = 0; j < 5; j++)
                    Console.WriteLine("\t\t"+cardspack[u[i].cards[j]]);
                if(left!=-1)
                    Console.WriteLine("\nEnter n to take a new card from pile (or) m to take the dropped card(" + cardspack[left] + ") : ");
                else
                    Console.WriteLine("\n\t\tEnter n to take a new card from pile"); 
                char c = Convert.ToChar(Console.ReadLine());
                int newc=0;
                switch (c)
                {
                    case 'm':
                                   newc = left;
                                   Console.WriteLine("\n\n\t\tCard taken:" + cardspack[newc]);
                        break;
                    case 'n':
                        newc = getcard();
                        Console.WriteLine("\n\n\t\tNew card:" + cardspack[newc]);
                            break;
                }
                Console.WriteLine("\n\t\tEnter the card to drop(1-5):");
                int k = Convert.ToInt16(Console.ReadLine());
                left=u[i].cards[(k-1)];
                flag[left]=false;
                u[i].cards[(k-1)]=newc;
                Console.WriteLine("\n\t\tYour new cards are:\n");
                for (int j = 0; j < 5; j++)
                    Console.WriteLine("\n\t\t"+cardspack[u[i].cards[j]]);
                int x=check(u[i]);
                if (x == 1)
                    break;
                Console.ReadLine();
                if ((i + 1) == n)
                        i = -1;
                Console.Clear();
            }
                Console.Read();
        }
    }
}
Instant play,download the game : click here
 
đồng tâm
ReplyDeletegame mu
cho thuê nhà trọ
cho thuê phòng trọ
nhac san cuc manh
số điện thoại tư vấn pháp luật miễn phí
văn phòng luật
tổng đài tư vấn pháp luật
dịch vụ thành lập công ty trọn gói
thương lượng
thuyết mbp
erg là gì
nổi tiếng
chi square
nói chuyện trước công chúng
định lý
victor vroom
chiến thắng con quỷ
điểm cân bằng
- Giám đốc Thái, xem ra anh thật sự sẽ lêm làm Phó chủ tịch tỉnh rồi. Tôi thấy anh như đàm phán với chúng tôi vậy.
Đổng Minh Đường đảo mắt mà nói.
- Không cần chụp mũ cho tôi. Bây giờ tôi chỉ là kiêm chức trợ lý chủ tịch tỉnh, phụ trách Sở Giao thông. Về phần ô nhiễm môi trường của nhà máy điện Hoa Dương, tôi chỉ nhắc nhở Tập đoàn Đông Năng một chút mà thôi.
Thái Chánh Dương xua tay nói:
- Không nói tới cái này, đến lúc đó Thành phố An Đô sẽ nói chuyện với Tập đoàn Đông Năng các anh.
- Ha ha, lão Thái, chúng tôi không phải không có thành ý, chúng tôi cũng muốn xử lý việc ô nhiễm môi trường, nhưng vấn đề nằm ở chỗ mọi người đều biết nhiệt điện ảnh hưởng tới hoàn cảnh xung quanh, nếu muốn một bước giải quyết vấn đề là không thể.
Đổng Minh Đường không muốn chuyển đề tài vì biết Thái Chánh Dương có thông tin gì đó.
- Không phải không thực tế mà là do Tập đoàn Đông Năng các anh không quyết tâm giải quyết.
Thái Chánh Dương lắc đầu nói:
- Ha ha, anh đừng định nghe tin từ tôi, thứ nhất tôi không biết, thứ hai không tới lượt tôi nói chuyện với các anh. Sở Bảo vệ môi trường tỉnh sẽ có chuyên gia đến bàn với các anh.
Thái Chánh Dương cười nói.
- Thái độ như vậy có thể ảnh hưởng tới tính tích cực đầu tư vào tỉnh An Nguyên của Tập đoàn Đông Năng chúng tôi đó.
- Đúng như anh nói, Tập đoàn Đông Năng là công ty, cứ có hạng mục phù hợp với các anh, kiếm ra tiền thì dùng gậy đánh Tập đoàn Đông Năng cũng không đi. Không có hạng mục có lợi, dù lấy dây buộc các anh, các anh cũng không chịu xuống nước.
Thái Chánh Dương trừng mắt nhìn Đổng Minh Đường:
- An Nguyên có nguồn tài nguyên nước phong phú, nhất là khai thác tài nguyên nước đứng hàng đầu cả nước. Tập đoàn Đông Năng các anh luôn ngại quy mô đầu tư quá lớn, thu vốn chậm. Nhưng bây giờ quốc gia đưa nhiều chính sách ưu đãi với phát triển thủy điện, hơn nữa bên nhiệt điện lại yêu cầu cao về bảo vệ môi trường. Hai bên ngang nhau, chẳng lẽ Tập đoàn Đông Năng các anh không suy nghĩ đến vấn đề này?