class Race
{
int[] race = new int[70];
int tortoise;
int hare;
Random randomnumbers = new Random();
bool again = true;
public void StartRace()
{
tortoise = 1;
hare = 1;
Console.WriteLine("ON YOUR MARK, GET SET.... BANG!!!");
Console.WriteLine("AND THEY'RE OFF!!!!");
while (tortoise < 70 && hare < 70)
{
MoveHare();
MoveTortoise();
DisplayCurrentLocation();
string request;
} //end while
if
(tortoise > hare)
{
Console.WriteLine("\n TORTOISE WINS!! YAY!!!!!");
}
else if
(hare > tortoise)
{
Console.WriteLine("\n HARE WINS!!!");
}
else if
(hare == tortoise)
{
Console.WriteLine ("TIE!!!");
}
public void MoveTortoise()
{
//to randomize move
int percent = randomnumbers.Next(1, 11);
//now determine moves based on graph
//fast plod
if (percent >= 1 && percent <= 5)
tortoise += 3;
//slip
else if (percent == 6 || percent == 7)
tortoise -= 6;
//slow plod
else
++tortoise;
// protect from going past start
if (tortoise < 1)
tortoise = 1;
// to make sure game ends
else if (tortoise > 70)
tortoise = 70;
}// end tortoise
public void MoveHare()
{
// randomize move
int percent = randomnumbers.Next(1, 11);
// determine moves by graph
//big hop
if (percent == 3 || percent == 4)
hare += 9;
//big slip
else if (percent == 5)
hare -= 12;
// small hop
else if (percent >= 6 && percent <= 8)
++hare;
// )small slip
else if (percent > 8)
hare -= 2;
//ensure hare doesn't go past start
if (hare < 1)
hare = 1;
// ensure hare doesnt go past end
else if (hare > 70)
hare = 70;
} // end movehare
public void DisplayCurrentLocation()
{
//this is the location of each on the array
for (int count = 1; count <= 70; count++)
// same spot
if (count ==tortoise && count ==hare)
{
Console.WriteLine ("OUCH");
}
else if (count == hare)
{
Console.WriteLine ("H");
}
else if (count == tortoise)
{
Console.WriteLine("T");
}
else
Console.WriteLine();
public class RaceTest
{
static void Main(string[] args)
{
Race Application = new Race();
string request;
do
{
Application.StartRace();
Console.WriteLine ("");
Console.WriteLine("Do you want to Play again y/n");
request = Console.ReadKey();
if (request == "Y" || request == "y")
{
again = true;
}
else
{
again = false;
}
}
while (again == true);
Console.Writeline ("Thank you for Playing");
}
}
I am looking for help with a school programming assignment. This is my first programming class and I'm a little lost as to what I am doing wrong. I have to create a simple tortoise and the hare race and I need to show them "T" and "H" as they go across the screen and offer the player to play again. I'm having some trouble with both of these. can anyone help? This is what I have so far??