Difference between revisions of "Team Blam-GridCode"

From CDOT Wiki
Jump to: navigation, search
(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…')
 
Line 3: Line 3:
 
*If you have any changes / upgrades to this code, post here for the benefit of others*
 
*If you have any changes / upgrades to this code, post here for the benefit of others*
  
 
+
<code>
 
using System;
 
using System;
 
using System.Collections.Generic;
 
using System.Collections.Generic;
Line 60: Line 60:
 
     }
 
     }
 
}
 
}
 +
</code>

Revision as of 10:24, 30 September 2010

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");
           }
       }
   }

}