Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   style (http://www.chiefdelphi.com/forums/showthread.php?t=4128)

srawls 04-05-2002 16:45

style
 
All of us programmers know we have to keep style in the code somehow, so my question is what did you do to the code, that you didn't really have to do, but you did cause it was just plain cool. I'll start off. Our mentor asked us to have version numbers for our program files, so when we modified the code we saved it as the next version number. Well, there's nothing fun about 1,2,3 ... so I added some style :cool: Basically, the version number approached pi, so the closer an aproximation each file was to pi, the newer the code was. I was also gonna make the code rhyme, but that didn't last long :rolleyes:

Stephen

K-RAD 04-05-2002 17:53

Dance code that makes the robot turn left and right and makes the LEDs on the operator interface toggle on and off. No one ever bothered to test it out because the only way to activate it was to have 3 OI conditions met that would never happen on the field occur in a certain order.

Oh, and I opimitized the code to be 43% smaller when tokenized. I was the only one who could read it ;)

Greg McCoy 04-05-2002 20:49

That's an interesting concept: Easter Eggs in FIRST Robots! :D

Gui Cavalcanti 04-05-2002 22:27

Heh...
 
Our robot this year could have been easily controlled with the default program, unfortunately. So Linda and I sat down and wrote out a line of code containing some 50 characters for each motor that would essentially do nothing on a perfectly-working robot but would get rid of the friction on the drive train otherwise (as in, your robot would always be getting a little more power than it would be with motor = joystick if you calibrate it correctly).

I think WildStang should look into a pneumatic-driven pen holder. That way, they can deploy it at the end of a match and crab around, spelling out "111 forever" or some such. That would be quite interesting.

I know it's what I've been threatening to do to my team for awhile, since I've usually been the only programmer :) (Except it's 422 forever... yeah...)

VanWEric 13-05-2002 15:27

data
 
When our programming cell got bored we began to use the eeprom as our own personalized bbs. there was poetry and song writing. It was a work of art. if i ever get unlzay enough ill post some of the better quips.

srawls 13-05-2002 18:31

hahaha, i like that. if we actually have a programmer besides me next year we might decide to do that too. :) anyway, i'll post something else i did for style, but it wasn't with the code. well, team 314 'Big Mo' was passing out straw hats with their team name in orange lettering on them. i got one to protect my head from the sun, and got to playing with it durring the awards ceramony. i took off the 'M' so the hat now reads 'Big O.' :) only 3 other people on my team understood the computer science reference there, the rest took a very different meaning to it :rolleyes: (if you know what that is, i honestly didn't even know about that untill they told me, oh well, i still wear the hat for Big O notation)

Stephen

Andrew Rudolph 13-05-2002 18:42

We add little things about poeple in the team as notes in the program, like : Turn on tonys hair (its spikey) or Make the Robot RAN forward (ran is a kid on our team) so on and so forth. One time last year we got so bored we drew a drawing of one of our programmers (he has a big nappy fro)
good times good times



Andrew

Andy A. 13-05-2002 19:14

I'm not a programmer by anymeans, but on occasion when our programmer leaves the code up I'll add in comments in odd places. Some time's he notices them, other times he doesn't.

Lets just say he doesn't like people messing with his programs...

-Andy A.

DanL 13-05-2002 19:23

We didn't really do anything code-wise, but we had some fun controller-wise.

Our robot has a dual drive system - basically we're on wheels by default, and when we flick a switch, two cylindars push down on a tread system. When this happens, the robot is lifted up off the wheels and onto the treads. The overall effect is that the robot chasis looks like its bouncing. So, because our robot needed a bit more ghetto in it, I labeled that switch on the oi the "Hydros"

Then theres the fun with fortune cookies. I don't know how this started, but we began taping random fortune cookies (the fortunes, silly) onto the oi and onto the robot. Like in front of the joysticks, it says something to the effect of "Be calm and relaxed when facing an emergency." On the front panel of our robot, it says something to the effect of "Be kind and gentle towards others." Now, this becomes quite funny when you actually see our front panel... also notice the chipped Lexan on the right, along with the paintjob that used to be perfect. Needless to say, our bot is VERY kind and gentle towards others :D

Ian W. 13-05-2002 20:07

lol, but dan, you forgot something....

since i was bored when i wrote the code, some it went to "spagghetti code". little labels like 'Yay:' and 'SpinningLightThingyOn:'. needless to say, Dan had a bit of trouble understanding the code, so he went through and redid parts :p. although, i thin you can find some labels that have no relation to anything thrown in the code in a few spots. it's fun to do, especially when i get to instruct the new programmers next year... :D

DanL 13-05-2002 20:35

Oh yeah, forgot about that part. I guess it's because I tried to BLOCK IT OUT after I went back and redid the code so that IT WASN'T SO <insert explicative here> DIRTY!! I'm wondering, though, should we give the dirty code to the programmers next year just to be funny? Or should we give them the cleaned up and commented version? Or, just to add some more excitement, how about we give 'em the dirty code with a few 255's thrown in for an added bonus? ;)

Ameya 14-05-2002 16:06

Last year, we had a failed experiment with an active steering system. Instead of deleting the code, we just commented it out. This year, we began programming the robot using last year's code as a base. To clean up the code, I removed the commented out code and added a little gravestone :P

Also, in the last week I made a program that would use the optical sensor to find the center of the goal so that the robot could automatically grab it with our sickle. However, due to time constraints and the fact that no one wanted to add the (small) extra weight of the sensor, it was never used (or even tested!). But, being proud of the untested work, I kept it in the code, commented, with a little ascii I.V. fluid package keeping it alive.

Ian W. 14-05-2002 16:51

dan, why do you think i made a dirty code? how else will htey ever learn? :p

VanWEric 22-05-2002 15:23

raise a lil hell with rotel
 
forget about giving the newbs spaghetti code -- give them super clean hyper optimized code. pull out your math skillz and reduce every function to a single line. that will get some good facial expressions.

Ian W. 22-05-2002 16:18

LOL!! i guess we need to make two forms of the code, horrible and amazingly efficent. say this is what it was...this is what it is. :D good idea

Alex Forest 22-05-2002 18:28

since im not a programmer I'll leave it for Stephen to tell you guys what he wrote in the code....lovely names.....etc....I cant believe he didnt tell you about project world domination......

srawls 22-05-2002 21:29

shhh!!!! every time i plan a world domination somebody blabs the plans out in public! ug, when can i get a break? ;)

Anyway, I agree with VanWEric ... I almost completely removed all case expressions with mathematical equations. I also cracked out my boolean algebra skills and reduced/obfuscated some expressions. Also, last year I took a page of code and turned it into a 'paragraph equation' (it was that long!). Ahh, if only there were other programmers on my team that would appreciate all this.

Stephen

Oh, to the variable names Alex referred to. Chiaphua is so boring, I named that output var chalupa. Globe motor, nothing interesting in the name globe, so I named the var world_domination. I'll say it again, if you can't have style, there's no point in coding :D

Ian W. 22-05-2002 22:35

heh, it's still better than a label like 'SpinningLightThingyYay:'. i think we seriously had that in part of our code :p. oh well, me and dan were the only ones who read it anyways.

Alex Forest 23-05-2002 10:07

excuse me stephen, WHO named it world domtination??? what?? and what about littleblackclickything? and other various names for those dumb buttons?? huh? what now?? :D:D:D:D:D

Ian W. 23-05-2002 17:02

LOL! and i thought my code was bad. oh well, i think we should all post our code, see if other programmers can understand it. if it even amounted to anything, we'd all be able to read PBASIC much better :D.


All times are GMT -5. The time now is 06:36.

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