View Single Post
  #8   Spotlight this post!  
Unread 12-01-2007, 02:36
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 486
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: Scoring function in C

As far as execution speed, I'm not sure that this would make much of a difference, but would it be equivalent to replace lines 16 through 22 with:
Code:
while(c<8 && rack[c][b]==piece) c++;
Also, how fast is the pow function compared to say, an array that you make that just contains the correct number of points for a given length? This would also allow you not to use math.h.

Add:
Code:
int run_points[9]={0,0,4,8,16,32,64,128,256};
and then replace:
Code:
pow(2,counter);
with
Code:
run_points[counter];
Edit:
-Corrected a couple of brackets.

-I've also written my own version of a score keeping program, though I'm sure it runs many times slower than yours because it does fun things like passing lots of structures by value. Depending on what your using it for though, performance might not really be an issue and you might want to take a look. See: http://www.chiefdelphi.com/forums/sh...ad.php?t=51408

Last edited by SoftwareBug2.0 : 12-01-2007 at 02:50.