Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Multiple hands with highest card

Discussion in 'Scripting' started by Charlzz21, Sep 22, 2023.

  1. Charlzz21

    Charlzz21

    Joined:
    May 8, 2022
    Posts:
    1
    So I’m making a card game, where up to 5 hands are in play (5 cards per hand). The last card is face up and the person with the highest card will be the leader for the round.
    However, if multiple people share the highest card I don’t know how to handle the situation. So far I’ve just stored all the 5th cards in a List<GameObject>.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Don't conflate the physical existence / orientation of the cards (eg, the GameObjects) with the logical cards that make up a player's hand.

    For instance, if you and I are playing "combat pairs" against each other and we each have one card hidden and are sharing a common card that is also considered the other half of our "pair," then we have three cards in play:

    - my card
    - your card
    - shared card

    When you want to evaluate each of our hands, to evaluate mine you would consider;

    - my card + shared card

    To evaluate yours you would consider:

    - your card + shared card

    And from that you would get two results, which can then be compared.

    Otherwise, not sure what your question is exactly...

    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220

    This is the bare minimum of information to report:

    - what you want
    - what you tried
    - what you expected to happen
    - what actually happened, log output, variable values, and especially any errors you see
    - links to documentation you used to cross-check your work (CRITICAL!!!)

    The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven't put effort into finding the documentation, why should we bother putting effort into replying?



    If you post a code snippet, ALWAYS USE CODE TAGS:

    How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/

    - Do not TALK about code without posting it.
    - Do NOT post unformatted code.
    - Do NOT retype code. Use copy/paste properly using code tags.
    - Do NOT post screenshots of code.
    - Do NOT post photographs of code.
    - ONLY post the relevant code, and then refer to it in your discussion.
     
  3. orionsyndrome

    orionsyndrome

    Joined:
    May 4, 2014
    Posts:
    3,043
    Well this sounds like a design problem, not a coding problem.

    You obviously need a tie breaker in your card game, and that's usually the seating order, or the sum of the remaining cards, or the strongest hand etc.

    Once you decide which design you wish to go after, only then we can talk about implementation.