Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Anyone know to make the AI for a 100m olympic style game?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
born130




PostPosted: Mon May 12, 2003 10:16 pm   Post subject: Anyone know to make the AI for a 100m olympic style game?

Hello

Another question I have is how would i make the AI, for example I have an 8 lane race. How would I make the AI for this, such that the race ends if the AI finishes before the human player?

My ideas are simply a terminate command if the first AI passes a certain point, i.e. the finish line.

Also anyone know how I could put an onscreen timer?

A slightly harder problem I need tackled is, how would i make the human player have a sort of acceleration bar. Meaning the faster i press the button"a" the faster he will go, but also when he starts he starts slow to fast!

Thanks
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon May 12, 2003 11:02 pm   Post subject: (No subject)

AI is simple... just keep the computer player running at same uniform speed depending on the level. Harder level = faster computer. Nothing fansy there.

As for the timer, just youse clock() function and use
code:

var c:int
loop
clock(c)
locate(1,1)
put c
end loop


as for acceleration. Measure how many times the user clicks in sertain time period (using clock). Then find the difference between two time intervals.

Say user pressed 5 times during 1st second and 7 times during 2nd.

So acceleration is 2 clicks per second^2
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Office of the Registar




PostPosted: Tue May 13, 2003 8:18 am   Post subject: (No subject)

what's the clock funciton do?
Tony




PostPosted: Tue May 13, 2003 8:40 am   Post subject: (No subject)

returns the time in milliseconds from when the program started...

by recording clock() value at two times and finding the difference, you can calculate how much time has passed between when those times were taken.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: