/// <summary> /// This method draws information such as the remaining ships and the hit chance to the CUI. /// </summary> /// <param name="player"></param> /// <param name="computer"></param> /// <param name="turn"></param> public void DrawInfoBox(Player player, Computer computer, int turn) { double hitChance = 0; double remainingTargets = 0; double remainingSquares = 0; Console.ForegroundColor = ConsoleColor.White; Console.BackgroundColor = ConsoleColor.Black; Console.SetCursorPosition(24, 1); Console.Write("Remaining Ships:"); Console.SetCursorPosition(24, 2); Console.BackgroundColor = ConsoleColor.Cyan; Console.Write("You: " + player.remainingShips()); Console.SetCursorPosition(24, 3); Console.BackgroundColor = ConsoleColor.Red; Console.Write("CPU: " + computer.remainingShips()); Console.BackgroundColor = ConsoleColor.Black; remainingSquares = 100 - turn; for (int currentShip = 0; currentShip < 5; currentShip++) { remainingTargets += computer.ships[currentShip].health; } hitChance = Math.Round((double)((remainingTargets / remainingSquares) * 100), 1); //makes the hit chance nicer to look at and stops it from scrolling off the CUI. Console.SetCursorPosition(24, 4); Console.Write("Hit Chance: " + hitChance + "%"); Console.SetCursorPosition(0, 0); }