Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Anyone know to make the AI for a 100m olympic style game?
Author Message
born130

Posted: 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

Tony

Posted: 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
Tony's programming blog. DWITE - a programming contest.
Office of the Registar

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

what's the clock funciton do?
Tony

Posted: 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.
Tony's programming blog. DWITE - a programming contest.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 4 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: