Esempio n. 1
0
        private void PutOnFootware()
        {
            int command = 1;

            if (_commands.Contains("6"))
            {
                int socksIndex = -1;
                if (_commands.Contains("3"))
                {
                    socksIndex = Array.IndexOf(_commands, "3");
                }
                int pantIndex     = Array.IndexOf(_commands, "6");
                int footWareIndex = Array.IndexOf(_commands, "1");
                if ((footWareIndex > pantIndex) | (footWareIndex > socksIndex & footWareIndex > pantIndex))
                {
                    if (_temperature == "COLD")
                    {
                        UpdateOutPut(OutputResponse.ColdResponse(command));
                    }
                    else
                    {
                        UpdateOutPut(OutputResponse.HotResponse(command));
                    }
                }
                else
                {
                    UpdateOutPut("Fail");
                }
            }
            else
            {
                UpdateOutPut("Fail");
            }
        }
Esempio n. 2
0
        /* //Only 1 piece of each type of clothing may be put on
         * private Boolean CheckForDuplicates()
         * {
         *   List<string> val = new List<string>();
         *   foreach (string s in _commands)
         *   {
         *       if (val.Contains(s))
         *       {
         *           return false;
         *       }
         *       val.Add(s);
         *       // if (_temperature == "cold")
         *       //   UpdateOutPut(OutputResponse.ColdResponse(Int32.Parse(s)));
         *       //else
         *       //  UpdateOutPut(OutputResponse.HotResponse(Int32.Parse(s)));
         *   }
         *   return true;
         * }*/


        private void PutOnShirt()
        {
            int command = 4;

            if (_commands.Contains("2"))
            {
                int jacketIndex = -1;
                if (_commands.Contains("5"))
                {
                    jacketIndex = Array.IndexOf(_commands, "5");
                }
                int shirtIndex    = Array.IndexOf(_commands, "4");
                int headwearIndex = Array.IndexOf(_commands, "2");
                if ((shirtIndex < headwearIndex) | (shirtIndex < jacketIndex & shirtIndex < headwearIndex))
                {
                    if (_temperature == "COLD")
                    {
                        UpdateOutPut(OutputResponse.ColdResponse(command));
                    }
                    else
                    {
                        UpdateOutPut(OutputResponse.HotResponse(command));
                    }
                }
                else
                {
                    UpdateOutPut("Fail");
                }
            }
            else
            {
                UpdateOutPut("Fail");
            }
        }
Esempio n. 3
0
        private void PutOnSocks()
        {
            int command = 3;

            if (_temperature == "COLD")
            {
                UpdateOutPut(OutputResponse.ColdResponse(command));
            }
            else
            {
                UpdateOutPut(OutputResponse.HotResponse(command));
            }
        }
Esempio n. 4
0
        //If the first step is not Removing PJ's we print failure.
        private Boolean TakeOffPajamas()
        {
            int command = 8;

            if (_commands[0] != "8")
            {
                //UpdateOutPut("Fail");
                return(false);
            }
            else
            {
                UpdateOutPut(OutputResponse.ColdResponse(command));
                return(true);
            }
        }
Esempio n. 5
0
        //You cannot leave the house until all items of clothing are on (except socks and a jacket when it’s hot)
        private void LeaveHouse()
        {
            int command      = 7;
            int leavingIndex = Array.IndexOf(_commands, "7");

            if (_temperature == "COLD" & leavingIndex == 7)
            {
                UpdateOutPut(OutputResponse.ColdResponse(command));
            }
            else if (_temperature == "HOT" & leavingIndex == 5)
            {
                UpdateOutPut(OutputResponse.HotResponse(command));
            }
            else
            {
                UpdateOutPut("fail");
            }
        }