Go to Post I'm pretty sure Andrew Baker and Andy Baker are the same person. Then again, Andy may just be holding out on us. - Amanda Morrison [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-12-2006, 14:24
teh_pwnerer795 teh_pwnerer795 is offline
Registered User
AKA: !!Mitch!!
FRC #1392
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Ajax, Canada
Posts: 142
teh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really nice
Send a message via MSN to teh_pwnerer795 Send a message via Yahoo to teh_pwnerer795
Number of lines of code in user_routines.c

Hey guys!

My code is HUGE!! .. i mean huge.. well at least i think it is just an overall question for all u guys out there programming this year.. my code is nearly 800 lines of code... including comments.. My question to u guys is.. 'How many lines of code does ur program have just for user_routines.c (including side files)?'

Just cuz im working on my camera code.. and went from 400 to 700....... ima bad programmer... well not really... i just write long code! but then i end up breaking it down... if yu could let me noe that would be great!
__________________
Great Art is Created; Master Pieces are Stolen

[n00b]Teh_Foxdonut teh_pwnerer795 - CounterStrike:Source
  #2   Spotlight this post!  
Unread 31-12-2006, 14:41
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Number of liines of code in user_routines.c

Quote:
Originally Posted by teh_pwnerer795 View Post
my code is nearly 800 lines of code... including comments.. My question to u guys is.. 'How many lines of code does ur program have just for user_routines.c (including side files)?'
I wouldn't worry about it. Our "user" code from last year was 7000 lines, and that was the simplest robot we've had in years.
  #3   Spotlight this post!  
Unread 31-12-2006, 14:58
teh_pwnerer795 teh_pwnerer795 is offline
Registered User
AKA: !!Mitch!!
FRC #1392
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Ajax, Canada
Posts: 142
teh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really nice
Send a message via MSN to teh_pwnerer795 Send a message via Yahoo to teh_pwnerer795
Re: Number of liines of code in user_routines.c

Quote:
Originally Posted by Dave Flowerday View Post
I wouldn't worry about it. Our "user" code from last year was 7000 lines, and that was the simplest robot we've had in years.
wow! 7000? ok im good thxs getting scared that mine was gettin too long
__________________
Great Art is Created; Master Pieces are Stolen

[n00b]Teh_Foxdonut teh_pwnerer795 - CounterStrike:Source
  #4   Spotlight this post!  
Unread 31-12-2006, 15:53
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: Number of liines of code in user_routines.c

Yeah under a 1000 isnt bad. Also it has to do with how you code. Theres all sorts of ways to cut number of lines in half without changing anything.

Example

PHP Code:
for(blah){
junk();

instead of

PHP Code:
for(blah)
{
junk();

cuts out 1 line. Its all how you liek to do it.
  #5   Spotlight this post!  
Unread 31-12-2006, 16:08
teh_pwnerer795 teh_pwnerer795 is offline
Registered User
AKA: !!Mitch!!
FRC #1392
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Ajax, Canada
Posts: 142
teh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really nice
Send a message via MSN to teh_pwnerer795 Send a message via Yahoo to teh_pwnerer795
Re: Number of liines of code in user_routines.c

Quote:
Originally Posted by chris31 View Post
PHP Code:
for(blah)
{
junk();

I mostly do it this way... and i also include all the brackets... even though sometimes you dont have too..
__________________
Great Art is Created; Master Pieces are Stolen

[n00b]Teh_Foxdonut teh_pwnerer795 - CounterStrike:Source
  #6   Spotlight this post!  
Unread 31-12-2006, 16:10
Donut Donut is offline
The Arizona Mentor
AKA: Andrew
FRC #2662 (RoboKrew)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Goodyear, AZ
Posts: 1,307
Donut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond repute
Re: Number of liines of code in user_routines.c

Yeah, depending on your style of coding and how many comments you actually add, the lines can vary tremendously. What's more important is the actual amount of data space you use. If you're using MPLAB (and I'm assuming you are), go to View->Memory Usage Gauge, and this will tell you both the amount of code and variable space you're using.

We overflowed the 2005 processor trying to get the camera and a driver perspective drive system with a gyro working. Last year we ended up using about 1/5 of the available space.
__________________
FRC Team 498 (Peoria, AZ), Student: 2004 - 2007
FRC Team 498 (Peoria, AZ), Mentor: 2008 - 2011
FRC Team 167 (Iowa City, IA), Mentor: 2012 - 2014
FRC Team 2662 (Tolleson, AZ), Mentor: 2014 - Present
  #7   Spotlight this post!  
Unread 31-12-2006, 16:12
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Number of liines of code in user_routines.c

So assuming some one uses a very inefficient coding style i.e something like this:
Code:
int values[3];
for(int i =0; i<=2; i ++)
{
    switch i
    case 0:
    values[0] = 0;

    case 1:
    values[1] = 0;

    case 2:
    values[2] = 0;
}
versus:
Code:
for (int i =0; i<=2, i++)
{
     values[i] = 0;
}
The modern compiler should still spit out the same machine code correct?
__________________
Team 701
  #8   Spotlight this post!  
Unread 31-12-2006, 17:05
Cjmovie's Avatar
Cjmovie Cjmovie is offline
1293 Resident Hacker
AKA: Christopher Corsi
FRC #1293 (D5 Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: SC
Posts: 73
Cjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to all
Re: Number of liines of code in user_routines.c

In an ideal world, yes, the compiler should do about the same thing. However, we're talking about MPLAB's compiler here, and it's far from "ideal". Something tells me even GCC would have difficulty optimizing it. My best bet goes to Intel's super-optimizing compiler. It's too bad we can't have something like that for our PICs.

As for code length in user_routines.c? It's only about 400-500. That's because I split my code up into multiple files. In all, I think I've written about 2000 in the pre-season this year. I've also taken the time to write my own camera code as opposed to Kevin's (it's good, just a little drawn out, IMHO).
__________________
D5 Robotics, Team 1293: Programmer, CAD'er, Mechanical, Electrical... I've made my rounds.
Events: 2006-2009 Palmetto Regional
Website: http://d5robotics.org/

Last edited by Cjmovie : 31-12-2006 at 17:07.
  #9   Spotlight this post!  
Unread 31-12-2006, 17:19
Jimmy Cao Jimmy Cao is offline
Registered User
AKA: Jimmy Cao
no team
 
Join Date: Sep 2006
Rookie Year: 2004
Location: San Francisco, CA
Posts: 295
Jimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant futureJimmy Cao has a brilliant future
Re: Number of liines of code in user_routines.c

Quote:
Originally Posted by teh_pwnerer795 View Post
My code is HUGE!! .. i mean huge.. well at least i think it is just an overall question for all u guys out there programming this year.. my code is nearly 800 lines of code... including comments.. My question to u guys is.. 'How many lines of code does ur program have just for user_routines.c (including side files)?'
great!
The # of lines is kinda irrelevent, they could be blank lines, or comments or stuff

The code from my team last year for FIRST is slightly over 900 lines, and that's before the precompiler includes all the files and stuff.

Don't worry if your code's really large, maybe it's huge cuz it needs to be cuz it does a lot, who knows.
__________________
Jimmy Cao

Team 469 2006-2010 Student/Alumni
Team 830 2011-2012 Mentor
  #10   Spotlight this post!  
Unread 31-12-2006, 17:49
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Number of liines of code in user_routines.c

The current code I have for user_routines.c is 111 lines long.

I gutted it (all those Limit_ functions are gone; I never used them) and I haven't put the drive code back in since the rewrite. That's why it's so short. Plus I have the code spread into other files I created, too.

Don't worry about it being long. Worry about it being readable. Being up late in the shop night before ship date you may be tempted to just keep writing, but when you have to decipher it to figure out why autonomous mode did nothing, you will smack yourself if it isn't readable.

JBot
__________________
Aren't signatures a bit outdated?
  #11   Spotlight this post!  
Unread 01-01-2007, 03:54
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Number of lines of code in user_routines.c

It's not code length... it's code functionality.

i believe ours was about 1,200 lines long... and i code in the most space saving style imaginable.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
  #12   Spotlight this post!  
Unread 01-01-2007, 04:36
JamesBrown JamesBrown is offline
Back after 4 years off
FRC #5279
Team Role: Engineer
 
Join Date: Nov 2004
Rookie Year: 2005
Location: Lynchburg VA
Posts: 1,281
JamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond repute
Re: Number of lines of code in user_routines.c

Code length in C varies drastically based on style. If you use alot of functions your user_routine.c will be much shorter but you may have a huge header file some where.
__________________
I'm Back


5279 (2015-Present)
3594 (2011)
3280 (2010)
1665 (2009)
1350 (2008-2009)
1493 (2007-2008)
1568 (2005-2007)
  #13   Spotlight this post!  
Unread 01-01-2007, 09:10
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: Number of lines of code in user_routines.c

Basically if your worried about space just remember to use the right data type. No reason to be keeping a counter that goes from 1 to 10 in an int.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
position of fleid lines Tachion FIRST Tech Challenge 1 05-12-2005 14:36
field lines Tachion FIRST Tech Challenge 0 15-11-2005 15:46
cruise lines robot180 Chit-Chat 9 29-06-2004 22:03
Extruding Lines Jim Giacchi Inventor 7 21-08-2002 17:30


All times are GMT -5. The time now is 20:42.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi