|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Teach Genia How to Program and Win a Prize
So, many people are aware of my lack of technical or programming knowledge.
However, I was so inspired today by a conversation between me and user "nehalita" that I had to create a little something to aid my progress in the technical world. Seriously speaking, I've always been interestsed in it, but always failed before I got to the programming self-study books. So here's what I know so far. Chocolate == chip, Oreo '= chip, but chocolate == oreo So uh, accelerate my knowledge, so maybe myself (and some other programming inept people) will be able to follow the entire mess. Edit: And it's a really really awesome prize! Thanks - Genia Btw: With all due respect to programmers, this thread is created as a self-make fun of. I admire you guys like mad, you make the robots work . So appreciate my interest.Last edited by Eugenia Gabrielov : 21-02-2005 at 17:36. |
|
#2
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
why don't we try if-then statements.
like: Code:
if (genia understands programming)
{
miracle = 1; //1 means true, so there IS a miracle
}
else
{
normal = 1; //normal is true
}
SOOO what i'm saying is, if genia understands programming, then it's a miracle but otherwise, all is normal. Last edited by nehalita : 21-02-2005 at 18:00. |
|
#3
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
|
|
#4
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
Quote:
![]() |
|
#5
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
Quote:
...you're right. mistake x.x'. let me fix that.... </L on forhead> Last edited by nehalita : 21-02-2005 at 17:57. |
|
#6
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
heres a simple loop
Code:
1 int amountOfLoops = 0;
2 while (amountOfLoops <= 100) {
3 amountOfLoops++; //adds one to amountOfLoops
4 System.out.println(amountOfLoops); //outputs amountOfLoops to screen
5 }
2 - Conditional statement saying that if amountOfLoops is less then or equal to 100 do what is within the brackets. 3 - "Increment" amountOfLoops, which just means add one to it. 4 - Prints the variable amountOfLoops to the screen (i.e. it would do 1 2 3 4 etc.). 5 - End Loop Last edited by DarkJedi613 : 21-02-2005 at 18:24. Reason: Clarification |
|
#7
|
||||
|
||||
|
Re: Teach Genia How to Program and Win a Prize
Quote:
Code:
Here are the main variables
#define pi 3.14159265358979 //defines pi
#define wheel (8*pi) //defines the circumferance of our wheels
#define wheeltick (wheel/32) // defines the ammount that the wheel moves in each tick
#define inch (1/wheeltick) // sets each tick into an inch form for ease of calculating distances
/*---------------------------------------------------*/
//basicly whats done here is reseting all the values to 0
int leftizzle[3] = {0, 0, 0};
int rightizzle[3] = {0, 0, 0};
int startposit; //not covered in this code segment, is the switch for case statements
int step = 0; // not covered in this code segment, but i do the auton in steps so that it resets its self throughout each phase
//that concludes resetting the values
/*------------------------------------------------*/
//now onto this bit of code
if (-1 <= leftizzle[2] < (inch*80.5))
{pwm01 = 180;}
if (condition) {action} the condition here is the value of leftizzle if the value is true then the motor will go forward at the above speed to explain the condition if the variable leftizzle[2] the second part of the leftizzle set marked by an x (0,x,0) if leftizzle is greater than or equal to -1 and less than 80.5 inches then the robot moves forward... hope that wasnt too confusing |
|
#8
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
that's actually some of the messiest code I've ever seen...
![]() |
|
#9
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
Well I figured a bit of it out!
so on Ron's Guide thingy that DarkJedi linked, you've got this # thing which means comment yes? I'm learning! But I'll keep looking ![]() Thanks for the code. And thanks to quite a few people for helping me develop my first code which I'll edit in here in a minute or two. |
|
#10
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
Quote:
And yes #, // and /* */ are all used to comment. Was there any particular language you were planning on learning? If not you should think about it so you can download a compiler and mess around with it. ![]() |
|
#11
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
Here it is everyone! My first code! thank you to all who contributed.
Most especially darkjedi ![]() Code:
passesLegendOfMaxOnHeavy(person) {
if (person==Genia) {
return true;
} else {
return false;
}
}
if(passesLegendOfMaxOnHeavy(Genia)) {
awesome=1;
} else {
triesAgain=1;
}
Last edited by Eugenia Gabrielov : 21-02-2005 at 19:21. Reason: acknowledgement |
|
#12
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
nice job. i think you're getting it =) according to my code up there, we have a miracle =P
|
|
#13
|
||||
|
||||
|
Re: Teach Genia How to Program and Win a Prize
Quote:
Code:
#define true 1
#define false 0
#define Genia 461
unsigned char passesLegendOfMaxOnHeavy(int person) {
if (person==Genia) {
return true;
} else {
return false;
}
}
if(passesLegendOfMaxOnHeavy(Genia)) {
awesome=1;
} else {
triesAgain=1;
}
Code:
#define dlavery 116 #define JVN 229 *removes nerd hat* I'm such a dork... Nonetheless, awesome, Genia. You might just be a CS major in training, if you're willing to trade in your social life. ![]() |
|
#14
|
||||
|
||||
|
Re: Teach Genia How to Program and Win a Prize
Quote:
|
|
#15
|
|||||
|
|||||
|
Re: Teach Genia How to Program and Win a Prize
Quote:
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|