public Form1() { InitializeComponent(); //Init things mainCanvas = CreateGraphics(); backgroundBrush = new SolidBrush(Color.LightBlue); foregroundPanelBrush = new SolidBrush(Color.Black); botList = new List<PetrolBot>(); shipList = new List<Ship>(); r = new Random(); //Instantiate some ships Ship s1 = new Ship(SHIP_SIZE, mainCanvas,r); Ship s2 = new Ship(SHIP_SIZE, mainCanvas,r); Ship s3 = new Ship(SHIP_SIZE, mainCanvas,r); Ship s4 = new Ship(SHIP_SIZE, mainCanvas,r); Ship s5 = new Ship(SHIP_SIZE, mainCanvas,r); //Add ships to the list shipList.Add(s1); shipList.Add(s2); shipList.Add(s3); shipList.Add(s4); shipList.Add(s5); //Instantiate some petrolBots PetrolBot pb1 = new PetrolBot(mainCanvas, Color.Lime, new Point(25, 425), BOT_SIZE, s1); PetrolBot pb2 = new PetrolBot(mainCanvas, Color.Orange, new Point(75, 425), BOT_SIZE,s2); PetrolBot pb3 = new PetrolBot(mainCanvas, Color.Purple, new Point(125, 425), BOT_SIZE,s3); PetrolBot pb4 = new PetrolBot(mainCanvas, Color.Teal, new Point(175, 425), BOT_SIZE,s4); PetrolBot pb5 = new PetrolBot(mainCanvas, Color.Yellow, new Point(225, 425), BOT_SIZE,s5); //Add bot to its list botList.Add(pb1); botList.Add(pb2); botList.Add(pb3); botList.Add(pb4); botList.Add(pb5); }
public Form1() { InitializeComponent(); canvas = CreateGraphics(); randomGenerator = new Random(); harbourBackgroundColour = Color.FromArgb(127, 127, 127); harbourBrush = new SolidBrush(harbourBackgroundColour); ships = new List<Ship>(); petrolBots = new List<PetrolBot>(); // Create Ships and their Petrol Bots for (int i = 0; i < NUMBER_OF_PETROL_BOTS; i++) { Ship newShip = new Ship(canvas, new Rectangle(0, 0, HARBOUR_WIDTH, HARBOUR_HEIGHT), randomGenerator); PetrolBot newPretrolBot = new PetrolBot(canvas, generateRandomColour(), newShip, i, HARBOUR_HEIGHT); ships.Add(newShip); petrolBots.Add(newPretrolBot); } runTheSimulations(); }
public Form1() { InitializeComponent(); canvas = CreateGraphics(); randomGenerator = new Random(); harbourBackgroundColour = Color.FromArgb(127, 127, 127); harbourBrush = new SolidBrush(harbourBackgroundColour); ships = new List <Ship>(); petrolBots = new List <PetrolBot>(); // Create Ships and their Petrol Bots for (int i = 0; i < NUMBER_OF_PETROL_BOTS; i++) { Ship newShip = new Ship(canvas, new Rectangle(0, 0, HARBOUR_WIDTH, HARBOUR_HEIGHT), randomGenerator); PetrolBot newPretrolBot = new PetrolBot(canvas, generateRandomColour(), newShip, i, HARBOUR_HEIGHT); ships.Add(newShip); petrolBots.Add(newPretrolBot); } runTheSimulations(); }