private bool ValidTrade()
    {
        /* Function to determine if a given trade-action follows the game rules.
         * Returns a boolean */

        // Construct new list containing names of all cards in SelectedCards
        // Also checks for "tradeable" property - will return false immediately
        // if a card contained in cardstotrade is not tradeable.
        List <string> CardsToTradeNames = new List <string>();

        foreach (GameObject card in gameController.SelectedCards)
        {
            // Check for tradeable
            propertiesScript = card.GetComponent <PropertiesScript>();
            if (!propertiesScript.tradeable)
            {
                return(false);
            }

            // Add to list
            CardsToTradeNames.Add(card.name);

            // Night cards count twice
            if (card.tag == "Night")
            {
                CardsToTradeNames.Add(card.name);
            }
        }

        // Cannot trade fewer than 2 cards for sticks (night cards counted twice)
        if (CardsToTradeNames.Count < 2)
        {
            return(false);
        }


        // Cannot trade cards of different varieties
        if (CardsToTradeNames.Distinct().Skip(1).Any())
        {
            return(false);
        }

        return(true);
    }
 private void Awake()
 {
     controller       = GameObject.Find("Controller");
     gameController   = controller.GetComponent <GameController>();
     propertiesScript = gameObject.GetComponent <PropertiesScript>();
 }
    /*                     *                     */

    private bool ValidCook()
    {
        /* Function to determine if a given cook-action follows the game rules.
         * Returns a boolean */

        // NOTE: Order of some of these rules is important.

        // Construct new list containing names of all cards in SelectedCards
        // Also checks for "cookable" property - will return false immediately
        // if a card contained in CardsToCook is not cookable.
        List <string> CardsToCookNames = new List <string>();

        foreach (GameObject card in gameController.SelectedCards)
        {
            // Check for cookable
            propertiesScript = card.GetComponent <PropertiesScript>();
            if (!propertiesScript.cookable)
            {
                return(false);
            }

            // Add to list
            CardsToCookNames.Add(card.name);

            // Night cards count twice
            if (card.tag == "Night")
            {
                CardsToCookNames.Add(card.name);
            }
        }

        // Cannot cook if no pans are available
        if (gameController.panCount == 0 && !CardsToCookNames.Contains("Pan"))
        {
            return(false);
        }

        // Cannot cook fewer than 4 cards if Butter is used
        // Cannot cook multiple Butter cards together
        if (CardsToCookNames.Contains("Butter"))
        {
            if (CardsToCookNames.Count < 4)
            {
                return(false);
            }

            if (CardsToCookNames.Count(name => name == "Butter") > 1)
            {
                return(false);
            }

            // Remove butter from list - makes later rule simpler.
            CardsToCookNames.Remove("Butter");
        }

        // Cannot cook fewer than 5 cards if Cider is used
        // Cannot cook multiple Cider cards together
        if (CardsToCookNames.Contains("Cider"))
        {
            if (CardsToCookNames.Count < 5)
            {
                return(false);
            }

            if (CardsToCookNames.Count(name => name == "Cider") > 1)
            {
                return(false);
            }

            // Remove cider from list - makes later rule simpler.
            CardsToCookNames.Remove("Cider");
        }

        // Cannot cook with multiple pan cards
        if (CardsToCookNames.Contains("Pan"))
        {
            if (CardsToCookNames.Count(name => name == "Pan") > 1)
            {
                return(false);
            }

            // Remove pan from list - makes next two rules simpler.
            CardsToCookNames.Remove("Pan");
        }


        // Cannot cook fewer than three cards (night cards counted twice)
        if (CardsToCookNames.Count < 3)
        {
            return(false);
        }

        // Cannot cook cards of different varieties
        if (CardsToCookNames.Distinct().Skip(1).Any())
        {
            return(false);
        }

        return(true);
    }