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

Username:   Password: 
 RegisterRegister   
 Point Scale
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Naveg




PostPosted: Tue May 24, 2005 6:16 pm   Post subject: Point Scale

I am making a game in which the user has to repeatedly do something, and each time they do it they get a different number of points. The scale is as follows:

1,1,1,2,2,2,3,3,5,5,7,10,25,50,75,250,500,1000

So for example, if the user does the required task 4 times, they will accumulate 5 points (1+1+1+2)

My question is, what is the most efficient way to check how many points the user has earned each time. I am trying to avoid a whole lot of if statements. Can this be done?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue May 24, 2005 6:24 pm   Post subject: Re: Point Scale

Vladimir wrote:
My question is, what is the most efficient way to check how many points the user has earned each time. I am trying to avoid a whole lot of if statements. Can this be done?


"check how many points the user has earned each time."

Why, whatever do you mean? If you make yourself clear, you make it easier for the people helping you.
Now, do you mean how many points the person earned last time? Or every single time? Why do you need to know this? I would assume your ultimate goal is to determine how many points he should get next time. Why don't you just have an array of values (that is your 1, 1, 1, 2, ....) and have a counter keep track of how many times they've gotten points. Beyond a certain point, your pattern seems to follow a doubling pattern (starting at 250, 500, 1000), so you don't need your array to go beyond there.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: