I have a problem here, I don't know what should I do, can someone help me, this my my project and i dont know what to do.. this is my initialcodes
Code:
/*The tortoise and the hare, in this project you will recreate one of the truly great moments in history,
namely the classic race of the tortoise and the hare.
Our contenders begin the race at “square 1” of 70 squares.
Each square represents a possible position along the race course.
The finish line is at square 70.
The first contender to reach or pass square 70 is rewarded with a pail of fresh carrots and lettuce.
The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground.
Your program should randomly adjust the position of the animals according to the following rules:
Animal Move type Random No Actual move
Tortoise Fast plod 1-5 3 squares to the right
Slip 6-7 6 squares to the left
Slow plod 8-10 1 square to the right
Hare Sleep 1-2 No move at all
Big hop 3-4 9 squares to the right
Big slip 5 12 squares to the left
Small hop 6-8 1 square to the right
Small slip 9-10 2 squares to the left
Keep track of the positions of the animals (values from 1 to 70).
Start each animal at position 1 (i.e. the “starting gate”).
If an animal slips below position 1, move the animal back to position 1.
For the tortoise, perform a “fast plod” when the random number is between 1 and 5,
a slip when 6 to 7 or a slow plod when 8 to 10. Use the same technique to move the hare.
Begin the race by printing “Bang!! And they’re off!!”. For each second, update the race track.
Occasionally the contenders will land on the same square.
In this case, the tortoise bites the hare and your program should print “Ouch” beginning at that position.
Test if either animal has reached or passed square 70. If so, then print the winner and terminate the simulation.
If both animals cross the finish line at the same time, you may want to print “It’s a tie”.*/
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
void main(){
int tortoise=0;
int hare=0;
int random;
int finish=70;
printf("The Race Between The Hare and The Tortoise/n");
printf("Bang!! And they’re off!!");
srand(time(NULL));
random= rand()%10 +1;
for(int race=1;tortoise !=finish && hare!=finish; race++)
{
//for tortoise
if (random>=1 && random<=5)
{tortoise+=3;}
else if (random>=6 && random<=7)
{tortoise-=6;}
else if(random>=8 && random<=10)
{tortoise+=1;}
else
{printf(" ", race);}
printf("T", tortoise);
//for hare
if (random>=1 && random<=2)
{hare=hare;}
else if (random>=3 && random<=4)
{hare+=9;}
else if(random==5)
{hare-=12;}
else if(random>=6 && random<=8)
{hare+=1;}
else if(random>=9 && random<=10)
{hare-=2;}
{printf(" ", race);}
printf("H", hare);
}
}