Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Chit-Chat (http://www.chiefdelphi.com/forums/forumdisplay.php?f=14)
-   -   Teach Genia How to Program and Win a Prize (http://www.chiefdelphi.com/forums/showthread.php?t=35161)

Eugenia Gabrielov 21-02-2005 17:27

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.

nehalita 21-02-2005 17:30

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
}

those slashes are comment thingers so when you program, you can keep track of what you write.

SOOO what i'm saying is, if genia understands programming, then it's a miracle but otherwise, all is normal.

DarkJedi613 21-02-2005 17:38

Re: Teach Genia How to Program and Win a Prize
 
heres a good site with very very short tutorials:

www.ronsguide.com

DarkJedi613 21-02-2005 17:53

Re: Teach Genia How to Program and Win a Prize
 
Quote:

Originally Posted by nehalita
why don't we try if-then loops.

That's actually not a loop, just a statement. :eek:

nehalita 21-02-2005 17:54

Re: Teach Genia How to Program and Win a Prize
 
Quote:

Originally Posted by DarkJedi613
That's actually not a loop, just a statement. :eek:

<L on forhead>
...you're right. mistake x.x'. let me fix that....
</L on forhead>

DarkJedi613 21-02-2005 17:58

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 }

1 - Defines the variable amountOfLoops (which is just the name) as an integer equal to zero.
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

Xufer 21-02-2005 18:41

Re: Teach Genia How to Program and Win a Prize
 
Quote:

Yummmmmmmm GLOMP (6:17:00 PM): hahahaha
Yummmmmmmm GLOMP (6:17:05 PM): we're working out some code
mobile xufer (6:17:29 PM): oh
mobile xufer (6:17:54 PM): just to make people laugh i made my code humerous ...
Yummmmmmmm GLOMP (6:18:00 PM): LOL
mobile xufer (6:18:13 PM): alot my variables end in izzle
Yummmmmmmm GLOMP (6:18:20 PM): hahahah
Yummmmmmmm GLOMP (6:18:21 PM): I have to see this
mobile xufer (6:18:28 PM): ill show you a section of it
mobile xufer (6:18:44 PM):
if (-1 <= leftizzle[2] < (inch*80.5))
{pwm01 = 180;}
Yummmmmmmm GLOMP (6:19:21 PM): SO CONFUSING
Yummmmmmmm GLOMP (6:19:22 PM): argh
Yummmmmmmm GLOMP (6:19:27 PM): post that on my programming thraed
Yummmmmmmm GLOMP (6:19:28 PM): and explain it
alright so heres a section of it

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;}

basic setup is

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

DarkJedi613 21-02-2005 18:43

Re: Teach Genia How to Program and Win a Prize
 
that's actually some of the messiest code I've ever seen... :(

Eugenia Gabrielov 21-02-2005 18:53

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.

DarkJedi613 21-02-2005 18:56

Re: Teach Genia How to Program and Win a Prize
 
Quote:

Originally Posted by Eugenia Gabrielov
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.

What language are you looking under? PHP is the only "real" programming language that Ron's Guides gives tutorials for.

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. :)

Eugenia Gabrielov 21-02-2005 19:14

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;
}

There you have it.

nehalita 21-02-2005 19:33

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

DarkJedi613 21-02-2005 19:44

Re: Teach Genia How to Program and Win a Prize
 
Wait...so whats the prize?! :D

nehalita 21-02-2005 19:51

Re: Teach Genia How to Program and Win a Prize
 
satisfaction

Xufer 21-02-2005 20:39

Re: Teach Genia How to Program and Win a Prize
 
Quote:

Originally Posted by DarkJedi613
that's actually some of the messiest code I've ever seen... :(

yea i don't pride myself on neatness infact my code isn't formatted or even commented at all i just did the commenting for Eugenia...


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

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