Exemple #1
0
        public static Guess Çöz()
        {
            Guess newGuess;

            switch (TahminDizisi.Count)
            {
            case 0:
                newGuess = Guess.Number(true);
                break;

            case 1:
                newGuess = Guess.Number(false);
                break;

            case 2:
                newGuess      = Guess.Number(false);
                newGuess.eksi = 4 - (TahminDizisi[0].hepsi + TahminDizisi[1].hepsi);
                TahminDizisi.Add(newGuess);
                goto atla2;;

            default:
atla2:
                TahminDizisi.Sort();
                newGuess = new Guess();
atla:
                redlist = new StringBuilder();
                string newNumber = "    ";
                foreach (Guess guess in TahminDizisi)
                {
                    string retval = Yerleştir(guess, newNumber);
                    if (retval == null)
                    {
                        ++newGuess.Retry;
                        if (newGuess.Retry > 200)
                        {
                            //DisplayAlert("Puanlama hatası", "Oyunu kaybettiniz", "OK");
                            return(null);
                        }
                        goto atla;
                    }
                    newNumber = retval;
                }
                if (newNumber.IndexOf(' ') > -1)
                {
                    ++newGuess.blank_digit; goto atla;
                }                                              //uğramazsa kaldır

                /*if (Consist(newNumber))
                 *  { ++newGuess.err_dublicate; goto atla;} */
                newGuess.number = newNumber;
                break;
            }
            TahminDizisi.Add(newGuess);
            return(newGuess);
        }
        // Note - The Xamarin.Forms Previewer requires a default, parameterless constructor to render a page.
        public ItemDetailPage()
        {
            InitializeComponent();

            var item = Guess.Number(true);

            item.arti      = 2;
            item.eksi      = 1;
            viewModel      = new ItemDetailViewModel(item);
            BindingContext = viewModel;
        }