View Single Post
  #32   Spotlight this post!  
Unread 03-14-2011, 08:15 PM
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Programming teams

Quote:
Originally Posted by MagiChau View Post
You are going to teach them all to abuse if then statements like proper programmers should right?
Actually, I am almost scared of if statements with more than 3 if then statements. I try to keep them at 2 or under. Or, in fact, even eliminate them. Well personally I think that comes with experience. Or it might just be my strange personality. I try to find that one equation that can do a whole bunch of if then statements can do. That is why I had so many feuds with the other programmer; he tries to code high level and I try to code the lowest level I can.

I think programming styles differ from one person to another. I was a if then statement spammer in my earlier years; but I just changed somehow. But I always stay away from recursive functions or anything like that. My mind functions more efficiently with equations rather than whatever you call recursive functions.

edit: This is what I mean; my drive code:
Code:
if(y <= pow(x, 2)/3 + 0.2 && y >= pow(x, 2)/-3 - 0.2)//pow is x^2 It is the dead zone for zero point turning. We can live with the else statement. 
{
pwm1 = x * 127 + 128;
pwm2 = x * 127 + 128;
}
else
{
pwm1 = (pow(y, 3) * 127 + 128) + (pow(x, 3) * 70);//x^3
pwm2 = (pow(y, 3) * 127 + 128) - (pow(x, 3) * 70);
}
regulate();//Just makes sure it does not go out of range
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.

Last edited by davidthefat : 03-14-2011 at 08:27 PM.