Пример #1
0
 public StatusData SetActiveCard([FromBody] InputCard pCard)
 {
     if (pCard == null)
     {
         return(new StatusData(-1, "Невірні вхідні дані"));
     }
     return(Bl.SetActiveCard(pCard));
 }
Пример #2
0
 //giao diện mặc định khi đặt phòng
 private void InterfaceDefaultOrder()
 {
     // giá tri các form
     CusName.Clear();
     InputCard.Clear();
     InputSDT.Clear();
     InputDescripsBill.Clear();
     numericAdult.Value    = 0;
     numeriChildrent.Value = 0;
     numericPrepay.Text    = "0";
     DataRooms.Rows.Clear();
     comboBoxCountry.SelectedIndex = 0;
     // sự kiển hiển thị popup chọn dịch vụ
     popupRoom.ItemClicked += new ToolStripItemClickedEventHandler(click_popupItem);
 }
Пример #3
0
        /// <summary>
        /// Translate cardspeak into double arrays so that the network can do the needful with it.
        /// </summary>
        private InputOutputPair ConvertCardToPair(InputCard card)
        {
            double[] inputs = GenerateInputs(card);

            if (inputs == null)
            {
                return(null);
            }

            double[] ideals = GenerateIdeals(card.Cost ?? "");

            return(new InputOutputPair
            {
                input = inputs,
                ideal = ideals
            });
        }
Пример #4
0
        /// <summary>
        /// Parse the oracle text for any keywords and light up those neurons
        /// </summary>
        private static double[] GenerateInputs(InputCard card)
        {
            var result = new double[InputVectorCount];

            for (int i = 0; i < _keywords.Count; i++)
            {
                result[i] = (card.RulesText ?? "").ToLower().Contains(_keywords[i]) ? 1.0 : 0.0;
            }

            // if the card is a dud, like a vanilla card or something stupid that doesn't do anything useful like
            // Search the city.  Just throw it out, we aren't dealing with that stuff.
            if (!result.Any(r => r > 0))
            {
                return(null);
            }

            var cmc = GetCmc(card.Cost);

            if (!cmc.HasValue)
            {
                return(null);
            }

            for (int i = _keywords.Count; i < InputVectorCount; i++)
            {
                if (i == _keywords.Count + cmc.Value)
                {
                    result[i] = 1.0;
                }
                else
                {
                    result[i] = 0.0;
                }
            }
            return(result);
        }