Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8575989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:49:18+00:00 2026-06-11T19:49:18+00:00

Possible Duplicate: 3 player card game turn system I’m making a GUI 3 player

  • 0

Possible Duplicate:
3 player card game turn system

I’m making a GUI 3 player card game (1 human and 2 computers). Each player has 3 cards in hand. In each round there is a dealer and the first player to play a card is the player at the right of the dealer. Each player can only play after the left player has played. (It’s the basis of a card game)

After each player had put the 3 cards on the table. The dealer button passes to the player at the right and a new round begin.

I need help to do a function to control the turns, which can see whose turn it is to play. I it is human turn, it waits for input. If it is computer turn, it calls the action function of the calss.

What I have now is a Card class with a Suit and a Value.

A Deck class that is a list of Cards ( this class has a suffle function and a draw card function)

I have a Table class that had a list of cards ( that is where the cards go when a player plays them)

I have a Player class ( the same class is for human and computer player – is this good? )

The Player class have a Hand class ( thats where the 3 cards of the player are )

The Game class has one deck, one table and 3 players.

I have the function that the human is the first to play and moves one card to the table, then the 2 computer players move one card each. This only works if the human player is the first to play. Once the 3 cards of each player are played, begins another round, in this round is not the player but the computer to first play.

I don’t have the idea how to make one system to control this. I don’t want code, but the idea itself.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:49:19+00:00Added an answer on June 11, 2026 at 7:49 pm

    I would have some properties like the following in my Player class:

    public bool IsComputer { get; set; }
    public bool IsCurrentTurn { get; set; }
    public int TurnOrder { get; set; }
    

    That way, you can write your logic based on if they are human or not and if it is their turn or not. You would use the TurnOrder property to determine whose turn it is next.

    So if you are creating your Player objects like this:

    Player player1 = new Player();
    

    You could add to your main logic something like this:

    if (player1.IsComputer) 
    {
       PerformTurn();
    }
    else //Human
    {
       //Logic to wait and allow human player to do his or her turn here
    }
    

    Edit:

    To determine whose turn it is, I would first have my players in a List of Player. Example:

    List<Player> players = new List<Player>
    {
    new Player {Name = "Player 1", IsComputer = false, TurnOrder = 0, IsCurrentTurn = true},
    new Player {Name = "Player 2", IsComputer = true, TurnOrder = 1, IsCurrentTurn = false},
    new Player {Name = "Player 3", IsComputer = true, TurnOrder = 2, IsCurrentTurn = false}
    };
    

    Second, I would create a function that uses the TurnOrder property of each player to determine whose turn it is next. A method like this would do it:

    public Player GetNextPlayer()
    {
       Player currentPlayer = players.First(x => x.IsCurrentTurn);
    
       //if player is last in the turn order return first player
       if (currentPlayer.TurnOrder == players.Max(x => x.TurnOrder).TurnOrder)
       {
           return players.Min(x => x.TurnOrder);
       }
       else 
       {
          return players.First(x => x.TurnOrder == (currentPlayer.TurnOrder + 1));
       }
    
    
    }
    

    Of course, you could just use the index of the list and skip using the TurnOrder altogether, although if you wanted to expand your game, using the index as the turn order may hurt you later on. I think the TurnOrder property is much more flexible.

    To get the next player in the turn, just use this:

    Player currentPlayer = GetNextPlayer();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Android game rpg inventory system Still stuck on making my rpg in
Possible Duplicate: Send NSString via Game Center i have been working on this for
Possible Duplicate: What Algorithm for a Tic-Tac-Toe Game Can I Use To Determine the
Possible Duplicate: Building a simple mp3 music player I want to create simplest mp3
Possible Duplicate: addEventListener in content script not working I'm making first steps to write
Possible Duplicate: How can I make my application check if Adobe flash player is
Possible Duplicate: Uninterrupted background music on website I have a music player built using
Possible Duplicate: Determine if two rectangles overlap each other? Considering I have 2 squares
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: && operator in Javascript In the sample code of the ExtJS web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.