Log in to check your private messages
Rive's Programming Thread of Doom
Page Previous  1, 2, 3 ... 5, 6, 7 ... 11, 12, 13  Next
 
Post new topic   Reply to topic    Rebels Forum Index » General Discussion View previous topic :: View next topic  
 Posted:  
Message
  Please Register and Login to this forum to stop seeing this advertsing.







 PostPosted: Mon Nov 02, 2009 9:06 pm Reply with quote  
Message
  Sirak Sazen
Knight - 5th Degree
Knight - 5th Degree

Joined: 25 Sep 2008
Posts: 6585


Location: The Asylum

Rive Caedo wrote:
Day 4 has been added. We might end up talking about this one for 2 days instead of 1 since...

a.) There's quite a bit of material there.
b.) I want to give Sirak a chance to catch up, if he wants, and Scion a chance to get into it.


I think I'll let you guys work on this. Maybe next year.  Wink
_________________


View user's profile Send private message Send e-mail Visit poster's website

 PostPosted: Tue Nov 03, 2009 12:13 am Reply with quote  
Message
  Scion
Gray Jedi Master
Gray Jedi Master

Joined: 14 Jan 2006
Posts: 3351


Location: Dakoth's Empire

OK, got it up and running.  I did what the second guy did, reDLed and Unzipped.  Worked Fine.

That being said, it is much more overwhelming than BLueJ, I can't actually get to a programming page. Embarassed

But I will call you on your Rock Paper Scissors Lizard Spock challenge.  (If it's even possible that is).
_________________


View user's profile Send private message AIM Address

 PostPosted: Tue Nov 03, 2009 1:29 am Reply with quote  
Message
  Dakoth
Senior Jedi Council Member
Senior Jedi Council Member

Joined: 31 Jan 2006
Posts: 12057


Location: Arkua

Here's my program, it works and I didn't cheat with the link Smile

Spoiler:

public class NeverTellMeTheOdds {public static void main(String[] args){
int counter = 0;
while(counter <=50){
System.out.println(counter);
counter = counter += 2;

}
}


}


_________________
Audi famam illius                                    Aftershock.


View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

 PostPosted: Tue Nov 03, 2009 2:32 am Reply with quote  
Message
  Rive Caedo
Jedi Grand Master
Jedi Grand Master

Joined: 02 Dec 2005
Posts: 9286


Location: Kallibann

Day 5 has been posted, but it's very short. If you understood Day 4's stuff, Day 5's concept should be a no-brainer.

It's worth noting that we're probably about halfway to having enough stuff defined for you to be at the "Level III" I previously defined.
Rive wrote:
III. Able to make some basic new features by knowing the basics of programming (example: adding a new force power that doesn't work like any previously created force powers)


Dakoth's Day 4: Looks good to me. Although...

Spoiler:

counter = counter += 2;

The 'counter =' on the far left is basically doing nothing. You're saying:

counter is assigned the value of counter being assigned the value of itself plus 2.

counter += 2; ("counter is assigned the value of itself plus 2.") would have done the job on its own.

It's definitely more important that your code works (which yours does) while you're learning. So don't worry about it too much Smile


_________________

Sergeant Frog: Because (no matter how much I deny it) Invader Zim isn't coming back Sad


View user's profile Send private message

 PostPosted: Tue Nov 03, 2009 2:43 am Reply with quote  
Message
  Dakoth
Senior Jedi Council Member
Senior Jedi Council Member

Joined: 31 Jan 2006
Posts: 12057


Location: Arkua

Spoiler:

 It would seem that I did indeed subscribe myself to the redundant department of redundancy.  I shall throw myself upon my sword posthaste.



Day 5's simple enuff.
_________________
Audi famam illius                                    Aftershock.


View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

 PostPosted: Tue Nov 03, 2009 3:38 am Reply with quote  
Message
  Rive Caedo
Jedi Grand Master
Jedi Grand Master

Joined: 02 Dec 2005
Posts: 9286


Location: Kallibann

For bonus credit you could read this, I suppose.

We call stuff like if statements and while loops (and for loops, which we'll talk about briefly soon)  control flow statements - since they control how you move through your program's code.

The link talks about switch statements - an alternative to if statements that are good to use in some specific situations.

I don't generally use them myself. I'll write up a big group of if statements and - when I'm finished - think "Oh, you know, that would have been a good place to do a switch block... oh well, I've already written these if statements" Razz
_________________

Sergeant Frog: Because (no matter how much I deny it) Invader Zim isn't coming back Sad


View user's profile Send private message

 PostPosted: Tue Nov 03, 2009 4:21 am Reply with quote  
Message
  Darth Acheron
Sith Emperor
Sith Emperor

Joined: 08 Jan 2006
Posts: 20578


Location: The Sith Temple

Woo! I figured Day 4 out all by myself!! Very Happy

I wasn't sure what to do because initially I had it around the wrong way, then I tried making it NOT equal odds, and that didn't work, so eventually I made it Counter = Counter -2 and it worked Very Happy



EDIT: Just realised 0 comes up, but when I replace >= 2 with > 2 it's all good.
_________________


Time to start again.


View user's profile Send private message Visit poster's website AIM Address MSN Messenger

 PostPosted: Tue Nov 03, 2009 4:31 am Reply with quote  
Message
  Rive Caedo
Jedi Grand Master
Jedi Grand Master

Joined: 02 Dec 2005
Posts: 9286


Location: Kallibann

Actually 0 does count as an even number, and I said starting with 0, so it should be included Smile

Anyway, good work. If I had specified, "print the numbers in order - least to greatest" - then your answer would be wrong, but I didn't - so I suppose you're fine, hehe.

I'm actually a bit surprised both of you got it without needing to ask questions. You either have a more natural knack for programming than most people - or I'm better teaching things than I give myself credit for Razz
_________________

Sergeant Frog: Because (no matter how much I deny it) Invader Zim isn't coming back Sad


View user's profile Send private message

 PostPosted: Tue Nov 03, 2009 4:33 am Reply with quote  
Message
  Darth Acheron
Sith Emperor
Sith Emperor

Joined: 08 Jan 2006
Posts: 20578


Location: The Sith Temple

Well.... I copy pasted the chunks of text from the start of this because I wasn't sure how to get it all right, then I looked at the 16 and the counter / 2 and tried to figure it out. Believe me, it took a while and I got into a loop where it kept printing 0s so I knew I'd done something wrong. Wink
_________________


Time to start again.


View user's profile Send private message Visit poster's website AIM Address MSN Messenger

 PostPosted: Tue Nov 03, 2009 4:48 am Reply with quote  
Message
  Rive Caedo
Jedi Grand Master
Jedi Grand Master

Joined: 02 Dec 2005
Posts: 9286


Location: Kallibann

There is another pretty good way to solve this problem, but it involves a mathematical concept you may not have even heard of - or, at least, not being used in this fashion. And it involves using an if statement anyway - which we didn't see until the next day, hehe.

Most students being taught division for the first time learn the concept of a "remainder".
Then they start doing more precise division allowing for decimals and such and the concept of a remainder is quickly abandoned.

But remainders are useful for computers! We obtain them via modulo operations. Designated in Java as '%'

So, a clever little test if something is odd is to say:
Does 2 evenly divide this number?
If so, it's even. The remainder would be 0.
If not, it's odd. The remained would be 1.

So this:


Is another, completely valid, way to solve the problem.

A good example of if statements from today and a good example that there can be many, many, many ways to approach a problem in programming Very Happy
_________________

Sergeant Frog: Because (no matter how much I deny it) Invader Zim isn't coming back Sad


View user's profile Send private message

 PostPosted: Tue Nov 03, 2009 5:01 am Reply with quote  
Message
  Darth Acheron
Sith Emperor
Sith Emperor

Joined: 08 Jan 2006
Posts: 20578


Location: The Sith Temple

In the "public static void main(String[] args) {" line, do we ever put anything in the []s?
_________________


Time to start again.


View user's profile Send private message Visit poster's website AIM Address MSN Messenger

 PostPosted: Tue Nov 03, 2009 5:02 am Reply with quote  
Message
  Dakoth
Senior Jedi Council Member
Senior Jedi Council Member

Joined: 31 Jan 2006
Posts: 12057


Location: Arkua

.....Did you just insinuate that we've never heard of remainders?!

But yeah, it was made a lot easier by having the  println and starting statement of doom available for copypasta.
_________________
Audi famam illius                                    Aftershock.


View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

 PostPosted: Tue Nov 03, 2009 5:03 am Reply with quote  
Message
  Darth Acheron
Sith Emperor
Sith Emperor

Joined: 08 Jan 2006
Posts: 20578


Location: The Sith Temple

Yea... dunno how I'm gonna go when you say, "Hey Alex, can you create a new character for me? kkthxbai"
_________________


Time to start again.


View user's profile Send private message Visit poster's website AIM Address MSN Messenger

 PostPosted: Tue Nov 03, 2009 5:09 am Reply with quote  
Message
  Rive Caedo
Jedi Grand Master
Jedi Grand Master

Joined: 02 Dec 2005
Posts: 9286


Location: Kallibann

Dakoth wrote:
.....Did you just insinuate that we've never heard of remainders?!

I insinuated you had heard of remainders - but had never heard of an operation called modulo to specifically obtain them - and had, most likely, never used a remainder for doing any useful work Smile

I was certainly surprised when I learned how often remainders are used for computers. If you weren't, good for you Razz

Xander Vos wrote:
In the "public static void main(String[] args) {" line, do we ever put anything in the []s?

No.
What the [] is doing is defining an array - which we'll talk about later.

For a specific answer about what that array is used for, you can read the somewhat complex answer here.

But, since our system will use a GUI (buttons and stuff - like the last one did), we don't really need to worry about the command line.
_________________

Sergeant Frog: Because (no matter how much I deny it) Invader Zim isn't coming back Sad


View user's profile Send private message

 PostPosted: Tue Nov 03, 2009 5:15 am Reply with quote  
Message
  Dakoth
Senior Jedi Council Member
Senior Jedi Council Member

Joined: 31 Jan 2006
Posts: 12057


Location: Arkua

Yippie! GUI!



_________________
Audi famam illius                                    Aftershock.


View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

Post new topic   Reply to topic    Rebels Forum Index » General Discussion

Page 6 of 13
All times are GMT
Page Previous  1, 2, 3 ... 5, 6, 7 ... 11, 12, 13  Next

Display posts from previous:

  

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2002 phpBB Group
Jedi Knights 2 by Scott Stubblefield

Create your own free forum | Buy a domain to use with your forum

The Star Wars Combine Banner Exchange