Beispiel #1
0
    public void Example4()
    {
        int[] warriors = new int[] {
            20,
            20,
            25,
            23,
            24,
            24,
            21
        };
        int[] horses = new int[] {
            20,
            25,
            25,
            20,
            25,
            23,
            20
        };
        int __expected = 0;
        int __result   = new BearCavalry().countAssignments(warriors, horses);

        Assert.AreEqual(__expected, __result);
    }
Beispiel #2
0
    public void Example3()
    {
        int[] warriors = new int[] {
            10,
            20
        };
        int[] horses = new int[] {
            1,
            3
        };
        int __expected = 1;
        int __result   = new BearCavalry().countAssignments(warriors, horses);

        Assert.AreEqual(__expected, __result);
    }
Beispiel #3
0
    public void Example0()
    {
        int[] warriors = new int[] {
            5,
            8,
            4,
            8
        };
        int[] horses = new int[] {
            19,
            40,
            25,
            20
        };
        int __expected = 2;
        int __result   = new BearCavalry().countAssignments(warriors, horses);

        Assert.AreEqual(__expected, __result);
    }
        //Listens to input from mouse and keyboard and carries out appropriate actions
        public void KeyboardListener(KeyboardState CurrentKeyboardState, KeyboardState LastKeyboardState, MouseState CurrentMouseState, MouseState LastMouseState)
        {
            //Creates an instance of a units at the position of the mouse when V is held down and left mouse button clicked
            if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) &&
                (CurrentKeyboardState.IsKeyDown(Keys.V)))
            {
                BaseUnit newUnit;
                newUnit = new Velociraptor();
                newUnit.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y));
                mUnits.Add(newUnit);
            }

            if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) &&
            (CurrentKeyboardState.IsKeyDown(Keys.B)))
            {
                BaseUnit newUnit;
                newUnit = new BearCavalry();
                newUnit.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y));
                mUnits.Add(newUnit);
            }

            if ((CurrentMouseState.LeftButton == ButtonState.Released && LastMouseState.LeftButton == ButtonState.Pressed) &&
            (CurrentKeyboardState.IsKeyDown(Keys.T)))
            {
                BaseUnit newUnit;
                newUnit = new Tank();
                newUnit.Build(new Vector2(CurrentMouseState.X, CurrentMouseState.Y));
                mUnits.Add(newUnit);
            }
        }
Beispiel #5
0
    public void Example5()
    {
        int[] warriors = new int[] {
            970,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800,
            800
        };
        int[] horses = new int[] {
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000,
            1000
        };
        int __expected = 318608048;
        int __result   = new BearCavalry().countAssignments(warriors, horses);

        Assert.AreEqual(__expected, __result);
    }