public void Build_wall_count_dora()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            Assert.AreEqual(1, wall.Doras.Count);
        }
        public void Build_wall_count_hidden_dead()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            Assert.AreEqual(13, wall.NumberOfHiddenDeadTiles);
        }
        public void Build_wall_count_drawable()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            Assert.AreEqual(122, wall.NumberDrawsRemaining);
        }
        public void Drawing_decreases_drawable_tiles_by_one()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            int prev = wall.NumberDrawsRemaining;

            wall.Draw();
            Assert.AreEqual(prev - 1, wall.NumberDrawsRemaining);
        }
        public void Cannot_draw_more_than_drawable()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            int draws = wall.NumberDrawsRemaining;

            for (int i = 0; i < draws; i++)
            {
                wall.Draw();
            }
            Tile next = wall.Draw();

            Assert.AreEqual(Tile.Invalid, next);
        }
Example #6
0
    private void TowerBuildUIClickedHandler(object sender, EventArgs args)
    {
        if (sender is TowerBuildUI)
        {
            if (_selection != null)
            {
                var towerBuildUI = (sender as TowerBuildUI);
                if (towerBuildUI.Prefab == null || ResourceManager.LoseMoney(towerBuildUI.Prefab.Cost))
                {
                    _selection.Build(towerBuildUI.Prefab);
                }
            }

            this.Cancel();
        }
    }
        public void Output_wall_to_file()
        {
            Wall wall = new Wall();

            wall.Build(RuleSets.DefaultRules);
            StreamWriter fout = new StreamWriter("output.txt");

            fout.WriteLine("New Wall:");
            fout.WriteLine("Dora: " + wall.Doras[0].ToString());
            fout.WriteLine("Wall tiles, in order: ");
            Tile tile;
            int  i = 1;

            while (wall.NumberDrawsRemaining > 0)
            {
                tile = wall.Draw();
                fout.WriteLine("    " + i + ": " + tile.ToString());
                i++;
            }
            fout.Close();
        }
Example #8
0
        public void Run()
        {
            Console.Title         = "Bouncing Ball";
            Console.CursorVisible = false;
            Console.SetWindowSize(90, 30);
            Console.BufferHeight = 30;
            Console.BufferWidth  = 90;
            int height = Console.BufferHeight;
            int width  = Console.BufferWidth;
            var border = new Border(width, height);

            border.CreateBorder();
            var wall = new Wall(47, 12, width, height);
            var ball = new Ball(45, 15, wall, width, height);

            var moveThread = new Thread(new ThreadStart(ball.Bounce));

            moveThread.IsBackground = true;
            moveThread.Start();

            wall.Build();
        }