Team Blam-GridCode

From CDOT Wiki
Revision as of 10:23, 30 September 2010 by Ajcondinho (talk | contribs) (Created page with 'Paste this into a Visual C# project and it will draw a bounding box for a grid of X's *If you have any changes / upgrades to this code, post here for the benefit of others* us…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Paste this into a Visual C# project and it will draw a bounding box for a grid of X's

  • If you have any changes / upgrades to this code, post here for the benefit of others*


using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace Console_Move {

   class Program
   {
       static void Main(string[] args)
       {
           drawGrid();
           //Grid is useable starting at 1,1
           //corner co-ords are
           //TL: 1,1
           //TR: 19,1
           //BL: 1,18
           //BR: 19,18
           Console.SetCursorPosition(0, 21);
           Console.WriteLine("All done");
       }
       static void drawGrid()
       {
           int i = 0;
           int x = 0;
           for (i = 1; i < 19; i++)
           {
               Console.SetCursorPosition(0, i);
               Console.Write("x");
           }
           for (x = 0; x < 20; x++)
           {
               Console.SetCursorPosition(x, i);
               Console.Write("x");
           }
           for (i = 0; i < 20; i++)
           {
               Console.SetCursorPosition(i, 0);
               Console.Write("x");
           }
           for (x = 0; x < 20; x++)
           {
               Console.SetCursorPosition(i, x);
               Console.Write("x");
           }
       }
   }

}