Ejemplo n.º 1
0
 public string FinalReport(Fleet opponent, int round)
 {
     string result = "";
     result = "\r\nAfter round " + round + " the " + name + " fleet won\r\n";
     result += "  " + opponent.GetNumberOfLostShips() + " enemy ships destroyed\r\n";
     result += "  " + GetNumberOfLostShips() + " ships lost\r\n";
     result += "  " + ships.NumberOfShip + " ships survived\r\n";
     result += ships.DamageReport();
     return result;
 }
Ejemplo n.º 2
0
        // Process user's inputs
        public void ProcessInputs(string seed, string file1, string file2)
        {
            // Validate files
            CheckFile(file1, "fleet 1");
            CheckFile(file2, "fleet 2");

            // Gather fleet from files
            fleet1 = GetFleet(file1);
            fleet2 = GetFleet(file2);

            // Generate random numbers for fleets
            Random rand = new Random(GetSeed(seed));
            fleet1.SetRandom(rand);
            fleet2.SetRandom(rand);
        }
Ejemplo n.º 3
0
 public Game(Fleet fleet1, Fleet fleet2)
 {
     this.fleet1 = fleet1;
     this.fleet2 = fleet2;
 }
Ejemplo n.º 4
0
 // Fire the fleet opponent
 public void Fire(Fleet opponent)
 {
     ships.Fire(opponent.Ships, rand);
 }