Ejemplo n.º 1
0
        public void Clear_Order()
        {
            Pennies              = 0;
            PenniesText.Text     = Pennies.ToString();
            Nickles              = 0;
            NicklesText.Text     = Nickles.ToString();
            Dimes                = 0;
            DimesText.Text       = Dimes.ToString();
            Quarters             = 0;
            QuartersText.Text    = Quarters.ToString();
            HalfDollars          = 0;
            HalfDollarsText.Text = HalfDollars.ToString();
            Dollars              = 0;
            DollarsText.Text     = Dollars.ToString();
            Ones              = 0;
            OnesText.Text     = Ones.ToString();
            Twos              = 0;
            TwosText.Text     = Twos.ToString();
            Fives             = 0;
            FivesText.Text    = Fives.ToString();
            Tens              = 0;
            TensText.Text     = Tens.ToString();
            Twenties          = 0;
            TwentiesText.Text = Twenties.ToString();
            Fifties           = 0;
            FiftiesText.Text  = Fifties.ToString();
            Hundreds          = 0;
            HundredsText.Text = Hundreds.ToString();

            TotalBox.Text = 0.00.ToString("C");
        }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     tenAnim   = Tens.GetComponent <Animator>();
     oneAnim   = Ones.GetComponent <Animator>();
     deltaTime = Time.time;
     roundTime = ROUND_TIME;
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("\n=====   Opgave 1 : Faculteit   =====\n");
            Factorial.Run();

            System.Console.WriteLine("\n=====   Opgave 2 : Fibonacci   =====\n");
            Fibonacci.Run();

            System.Console.WriteLine("\n=====   Opgave 3 : Alternately   =====\n");
            Alternately.Run();

            System.Console.WriteLine("\n=====   Opgave 4 : Enen   =====\n");
            Ones.Run();

            System.Console.WriteLine("\n=====   Opgave 6 : ForwardString   =====\n");
            ForwardBackwardString.Run();

            System.Console.WriteLine("\n=====   Opgave 7 : Sorting   =====\n");
            Sorter isort = new InsertionSort();
            Sorter msort = new MergeSort();
            Sorter ssort = new ShellSort();

            isort.Run();
            msort.Run();
            ssort.Run();
            int[] numbers = { 100, 1000, 10000 };
            foreach (int num in numbers)
            {
                isort.RunWithTimer(num);
                msort.RunWithTimer(num);
                ssort.RunWithTimer(num);
            }
        }
Ejemplo n.º 4
0
        public void OnesShouldReturnSumOf1s(List <int> rolledDice, int expectedOutcome)
        {
            var ones   = new Ones();
            var result = ones.CalculateScore(rolledDice);

            Assert.Equal(expectedOutcome, result);
        }
Ejemplo n.º 5
0
 private void Ones_minus(object sender, RoutedEventArgs e)
 {
     if (Ones - 1 < 0)
     {
         return;
     }
     Ones--;
     OnesText.Text = Ones.ToString();
     TotalBox.Text = Total.ToString("C");
 }
Ejemplo n.º 6
0
        public void GeneratesOutput()
        {
            using (var session = new TFSession())
            {
                var initializer = new Ones().Compile(session.Graph, new TFShape(5, 5));
                var output      = session.GetRunner().Run(initializer);

                output.Shape[0].Should().Be(5);
                output.Shape[1].Should().Be(5);
            }
        }
Ejemplo n.º 7
0
        public void OnesTest(int n, int expected)
        {
            int actual;

            // Arrange

            // Act
            actual = Ones.OnesRecursive(n);

            // Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BatchNorm"/> class.
 /// </summary>
 internal BatchNorm()
 {
     base.Name                 = "BatchNorm";
     base.Params               = new ExpandoObject();
     Shape                     = null;
     BetaInitializer           = new Zeros();
     GammaInitializer          = new Ones();
     RunningMeanInitializer    = new Zeros();
     RunningStdInvInitializer  = new Ones();
     Spatial                   = true;
     NormalizationTimeConstant = 4096f;
     BlendTimeConst            = 0;
     Epsilon                   = 0.001f;
 }
Ejemplo n.º 9
0
        protected string IntegerNumber(string number)
        {
            int           numDigit = number.Length;
            int           pos      = 0;
            string        place    = string.Empty;
            StringBuilder fword    = new StringBuilder();

            if (number.StartsWith("-"))
            {
                fword.Append("Minus");
                number = number.Substring(1);
            }

            while (number.Length > 0)
            {
                if (number.Length == 1)
                {
                    fword.Append(" " + Ones.GetOnes(number));
                    break;
                }
                else if (number.Length == 2)
                {
                    fword.Append(" " + Tens.GetTens(number));
                    break;
                }
                else
                {
                    place = GetPlaceValue(number, out pos);
                }

                if (pos == 1)
                {
                    fword.Append(" " + Ones.GetOnes(number.Substring(0, pos)));
                }
                else if (pos == 2)
                {
                    fword.Append(" " + Tens.GetTens(number.Substring(0, pos)));
                }
                else
                {
                    fword.Append(" " + IntegerNumber(number.Substring(0, pos)));
                }
                fword.Append(" " + place);
                number = number.Substring(pos);
                number = number.TrimStart('0');
            }
            return(fword.ToString().Trim());
        }
Ejemplo n.º 10
0
        protected string AfterDecimal(string number)
        {
            StringBuilder word = new StringBuilder();
            int           i    = 0;

            while (i < number.Length)
            {
                if (number[i] == '0')
                {
                    word.Append(" Zero");
                    i++;
                    continue;
                }
                word.Append(" " + Ones.GetOnes(number[i].ToString()));
                i++;
            }
            return(word.ToString().Trim());
        }
Ejemplo n.º 11
0
        List <Ones> GetACopy()
        {
            List <Ones> Copy = new List <Ones>();

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    if (board[i, j] == 1)
                    {
                        Position        tempPos  = new Position(i, j);
                        List <Position> tempList = new List <Position>();
                        tempList = GetAdjacent(tempPos);
                        Ones tempOne = new Ones(tempPos, tempList);


                        Copy.Add(tempOne);
                    }
                }
            }
            return(Copy);
        }
Ejemplo n.º 12
0
        private static double GetSumOnesValueAndOt(Ones ones)
        {
            var sum = 0D;

            if (ones.Value != null)
            {
                var value = ones.Value.Value / (ones.IsEpisodic
                    ? OnesConstants.DefaultEpisodicOnesValue
                    : OnesConstants.DefaultTheatricalOnesValue);

                sum += value;
            }

            if (ones.OverTime != null)
            {
                var ot = ones.OverTime.Value / (ones.IsEpisodic
                    ? OnesConstants.DefaultEpisodicOnesValue
                    : OnesConstants.DefaultTheatricalOnesValue);

                sum += ot;
            }

            return(sum);
        }
Ejemplo n.º 13
0
        public double GetMyThreats()
        {
            //TODO Get the heuristic function of the threats
            int         rows   = board.GetLength(0);
            int         col    = board.GetLength(1);
            List <Ones> myList = new List <Ones>();

            List <Position> ThreatsPos = new List <Position>();
            double          Threats    = 0.0;

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < col; j++)
                {
                    if (board[i, j] == 1)
                    {
                        Position        tempPos  = new Position(i, j);
                        List <Position> tempList = new List <Position>();
                        tempList = GetAdjacent(tempPos);
                        Ones tempOne = new Ones(tempPos, tempList);
                        myList.Add(tempOne);
                    }
                }
            }


            for (int i = 0; i < myList.Count; i++)
            {
                //List<Ones> Copy = myList;
                List <Ones>     Copy = GetACopy();
                Position        currentPos = myList[i].pos;
                List <Position> currentList = myList[i].AdjList;
                Position        checkingPos1 = new Position(0, 0);
                Position        checkingPos2 = checkingPos1;
                bool            firstCheck = false, secondCheck = false;
                bool            exists = false;

                int j     = i + 1;
                int index = i + 1;

                //check if this one is connected with any other one or not
                while (j != Copy.Count)
                {
                    exists = IsInThisList(currentPos, Copy[j].AdjList);

                    if (exists)
                    {
                        Copy.RemoveAt(j);
                        j++;
                        j--;
                    }
                    else
                    {
                        j++;
                    }
                }

                if (Copy.Count != 1) // donc fih lesa 3l a2al one wahda msh connected beya  3shan law =1 yb2a ana bas
                {
                    for (int l = index; l < Copy.Count; l++)
                    {
                        Position CurrentPosInList;
                        bool     existed;
                        bool     firstTime = true;
                        for (int k = 0; k < currentList.Count; k++)
                        {
                            CurrentPosInList = currentList[k];
                            existed          = IsInThisList(CurrentPosInList, Copy[l].AdjList);
                            if (existed)
                            {
                                if (firstTime)
                                {
                                    checkingPos1 = CurrentPosInList;
                                    ThreatsPos.Add(checkingPos1);
                                    firstCheck = true;


                                    firstTime = false;
                                }
                                else
                                {
                                    //second time and the last one
                                    checkingPos2 = CurrentPosInList;

                                    ThreatsPos.Add(checkingPos1);
                                    secondCheck = true;
                                }
                            }
                            if (firstCheck && secondCheck) //donc weslet lel pair el common ma ben 2 ones
                            {
                                if (board[checkingPos1.i, checkingPos1.j] == 0)
                                {
                                    if (board[checkingPos2.i, checkingPos2.j] == 0)
                                    {
                                        Threats += 1;
                                    }
                                    else if (board[checkingPos2.i, checkingPos2.j] == 1)
                                    {
                                        Threats += 1;
                                    }
                                }
                                else if (board[checkingPos1.i, checkingPos1.j] == 1)
                                {
                                    if (board[checkingPos2.i, checkingPos2.j] == 0)
                                    {
                                        Threats += 1;
                                    }
                                }

                                firstCheck  = false;
                                secondCheck = false;
                                firstTime   = true;
                            }
                        }
                    }
                }
            }

            return(Threats);
        }
Ejemplo n.º 14
0
 private void Ones_add(object sender, RoutedEventArgs e)
 {
     Ones++;
     OnesText.Text = Ones.ToString();
     TotalBox.Text = Total.ToString("C");
 }
Ejemplo n.º 15
0
        public static string GetTens(int number)
        {
            string name = string.Empty;
            bool   isDone;

            name = GetTensMatched(number, out isDone);
            if (!isDone && number > 0)
            {
                name = GetTensMatched(int.Parse(number.ToString().Substring(0, 1) + "0"), out isDone) + " " + Ones.GetOnes(number.ToString().Substring(1));
            }
            return(name);
        }