You are viewing an archived version of the site which is no longer maintained.
Go to the current live site or the Adventure Gamers forums
Adventure Gamers

Home Adventure Forums Misc. Chit Chat Super Huge Homework Help!


 
 
LinkBack Thread Tools
Old 04-23-2006, 09:34 PM   #61
Friendly Server Admin
 
tabacco's Avatar
 
Join Date: Sep 2003
Location: Marin County, CA
Posts: 4,087
Default

Quote:
Originally Posted by SakSquash
What's min()?
Like I said, it's a function that returns the lowest of two numbers. If that confuses you, try googling for "min" and "javascript"
tabacco is offline  
Old 04-24-2006, 05:09 AM   #62
Banned User
 
SakSquash's Avatar
 
Join Date: Nov 2004
Location: New Paltz...for now...
Posts: 6,177
Default

Nevermind.
SakSquash is offline  
Old 04-24-2006, 09:01 AM   #63
Homer of Kittens
 
SoccerDude28's Avatar
 
Join Date: Aug 2004
Location: San Francisco, Bay Area
Posts: 4,374
Default

Okay take this example. You have 3 numbers: X, Y and Z. (X, Y and Z can be any 3 numbers at random)

How would you go about finding which one is the smallest. Forget about programming for now, just use your common sense logic.
__________________
--------------------------------------------------
Games I am playing: Jeanne D'Ark (PSP)

Firefox rules
SoccerDude28 is offline  
Old 04-24-2006, 12:11 PM   #64
Banned User
 
SakSquash's Avatar
 
Join Date: Nov 2004
Location: New Paltz...for now...
Posts: 6,177
Default

Well...I would look at it...see which one is the smallest..and say yup, that's the smallest.

I think i'm missing your point?
SakSquash is offline  
Old 04-24-2006, 01:02 PM   #65
Dungeon Master
 
AFGNCAAP's Avatar
 
Join Date: Nov 2003
Location: Poland
Posts: 4,152
Default

What SoccerDude meant is: how to find the smallest number if you can compare only two at the time? (because the "min" function gives you the smaller of two, not three)

So, suppose you have three rocks and a scale such as this one (doesn't show you the weight, only allows to compare two things). How would you proceed to find the lightest one?
__________________
What's happening? Wh... Where am I?
AFGNCAAP is offline  
Old 04-24-2006, 01:28 PM   #66
Homer of Kittens
 
SoccerDude28's Avatar
 
Join Date: Aug 2004
Location: San Francisco, Bay Area
Posts: 4,374
Default

Quote:
Originally Posted by SakSquash
Well...I would look at it...see which one is the smallest..and say yup, that's the smallest.

I think i'm missing your point?
In computers you can only compare two elements to each other at one point. To find out if something is smaller than another you use a comparison operator (namely the "<" or ">" signs).

so to compare if X is smaller than Y, you would say if(X<Y).

So let's go back to our small example. You have 3 numbers hidden from you X, Y and Z. They can contain any number. You can compare two of them at a time, using the if operator like the example above. How do you go about finding the minimum of the 3 numbers. You can only compare two of them together at one point, and their contents is unknown to you before you run the program.
__________________
--------------------------------------------------
Games I am playing: Jeanne D'Ark (PSP)

Firefox rules
SoccerDude28 is offline  
Old 04-24-2006, 01:32 PM   #67
Banned User
 
SakSquash's Avatar
 
Join Date: Nov 2004
Location: New Paltz...for now...
Posts: 6,177
Default

I dunno? Something like X<Y, X<Z, Y<Z?
SakSquash is offline  
Old 04-24-2006, 01:42 PM   #68
Homer of Kittens
 
SoccerDude28's Avatar
 
Join Date: Aug 2004
Location: San Francisco, Bay Area
Posts: 4,374
Default

Quote:
Originally Posted by SakSquash
I dunno? Something like X<Y, X<Z, Y<Z?
Okay suppose you have 4 elements W, X, Y and Z, how would you find the minimum? EDIT: And you can also only compare 2 at a time.
__________________
--------------------------------------------------
Games I am playing: Jeanne D'Ark (PSP)

Firefox rules
SoccerDude28 is offline  
Old 04-24-2006, 04:03 PM   #69
Huz
Kersal Massive
 
Huz's Avatar
 
Join Date: Sep 2003
Location: Manchester
Posts: 1,430
Send a message via MSN to Huz
Default

God.
Huz is offline  
Old 04-24-2006, 04:06 PM   #70
Aj_
Beyond Belief
 
Aj_'s Avatar
 
Join Date: Jan 2005
Location: Blighty
Posts: 2,186
Default

Quote:
Originally Posted by SakSquash
I dunno? Something like X<Y, X<Z, Y<Z?
With three variables you only need to test twice. Once you know that X is smaller than Y and Z, you know it's the smallest.
For example:
x = 4
y = 5
z = 6

compare x, y // result x, compare it to the next
compare x, z // result x, x is the smallest

x = 5
y = 4
z = 6

compare x, y // result y
compare y, z // result y

x = 5
y = 6
z = 4

compare x, y // result x
compare x, z // result z

For just three you're looking at something like this, in pseudo code:
if (x<y)
result=x
else
result=y

if (result>z)
result=z

any more variables and you should be thinking about loops, on the same principle, just keep passing the smallest number to the next in the list, comparing, then passing that along, the number at the end is the smallest.

Last edited by Aj_; 04-25-2006 at 04:41 AM.
Aj_ is offline  
Old 04-24-2006, 04:21 PM   #71
Homer of Kittens
 
SoccerDude28's Avatar
 
Join Date: Aug 2004
Location: San Francisco, Bay Area
Posts: 4,374
Default

That's what I was trying to get to. I wanted Saksquash to think about a little though
__________________
--------------------------------------------------
Games I am playing: Jeanne D'Ark (PSP)

Firefox rules
SoccerDude28 is offline  
Old 04-24-2006, 04:40 PM   #72
Aj_
Beyond Belief
 
Aj_'s Avatar
 
Join Date: Jan 2005
Location: Blighty
Posts: 2,186
Default

Quote:
Originally Posted by SoccerDude28
That's what I was trying to get to. I wanted Saksquash to think about a little though
If he uses that logic with three variables, then the chances are he'll use them with four. He had a stab at it, didn't get it, I gave him an example to help him. I don't see the point in asking the same question twice.
Aj_ is offline  
Old 04-24-2006, 05:48 PM   #73
Banned User
 
SakSquash's Avatar
 
Join Date: Nov 2004
Location: New Paltz...for now...
Posts: 6,177
Default

God, I hate math.
SakSquash is offline  
Old 04-24-2006, 06:32 PM   #74
Diva of Death
 
Jeysie's Avatar
 
Join Date: Aug 2005
Location: Western Massachusetts
Posts: 1,402
Send a message via MSN to Jeysie
Default

Quote:
Originally Posted by SakSquash
God, I hate math.
Then, if I might be blunt, what the heck are you doing taking programming classes? I mean, coding is full of math, or at least related ways of thinking.

Peace & Luv, Liz
__________________
Adventures in Roleplaying (Nov. 19):

"Maybe it's still in the Elemental Plane of Candy."
"Is the Elemental Plane of Candy anything like Willy Wonka's factory?"
"If it is, would that mean Oompa Loompas are Candy Elementals?"
"Actually, I'm thinking more like the Candyland board game. But, I like this idea better."
"I like the idea of Oompa Loompa Elementals."
Jeysie is offline  
Old 04-24-2006, 06:49 PM   #75
Banned User
 
SakSquash's Avatar
 
Join Date: Nov 2004
Location: New Paltz...for now...
Posts: 6,177
Default

The course is web design...as in html...I didn't know i'd be doing java.
SakSquash is offline  
Old 04-24-2006, 07:03 PM   #76
Diva of Death
 
Jeysie's Avatar
 
Join Date: Aug 2005
Location: Western Massachusetts
Posts: 1,402
Send a message via MSN to Jeysie
Default

So... somehow you never expected a web design course to consist of learning web technologies?

Peace & Luv, Liz
__________________
Adventures in Roleplaying (Nov. 19):

"Maybe it's still in the Elemental Plane of Candy."
"Is the Elemental Plane of Candy anything like Willy Wonka's factory?"
"If it is, would that mean Oompa Loompas are Candy Elementals?"
"Actually, I'm thinking more like the Candyland board game. But, I like this idea better."
"I like the idea of Oompa Loompa Elementals."
Jeysie is offline  
Old 04-24-2006, 08:09 PM   #77
Banned User
 
SakSquash's Avatar
 
Join Date: Nov 2004
Location: New Paltz...for now...
Posts: 6,177
Default

Shut the **** up.
SakSquash is offline  
Old 04-24-2006, 09:32 PM   #78
Friendly Server Admin
 
tabacco's Avatar
 
Join Date: Sep 2003
Location: Marin County, CA
Posts: 4,087
Default

Quote:
Originally Posted by Jeysie
So... somehow you never expected a web design course to consist of learning web technologies?

Peace & Luv, Liz
No, he's right. I wouldn't neccesarily expect an HTML course to incorporate Javascript. I think it's good that it does, because it's a useful technology, but it's not something I think is a given in an intro to HTML course.
tabacco is offline  
Old 04-24-2006, 10:22 PM   #79
Diva of Death
 
Jeysie's Avatar
 
Join Date: Aug 2005
Location: Western Massachusetts
Posts: 1,402
Send a message via MSN to Jeysie
Default

Quote:
Originally Posted by tabacco
No, he's right. I wouldn't neccesarily expect an HTML course to incorporate Javascript. I think it's good that it does, because it's a useful technology, but it's not something I think is a given in an intro to HTML course.
Heh. Well, I have to admit I'm now curious about why he's taking the course. Because even if an Intro to HTML course didn't have javascript stuff, if you were going to be "serious" about web designing, you'd have to take classes on other web technologies eventually anyway, I would think.

Which is one reason why I never bothered getting serious about webmastering even though I enjoy it... trying to figure out most programming concepts (i.e. anything beyond HTML and CSS) gives me a headache.

Peace & Luv, Liz
__________________
Adventures in Roleplaying (Nov. 19):

"Maybe it's still in the Elemental Plane of Candy."
"Is the Elemental Plane of Candy anything like Willy Wonka's factory?"
"If it is, would that mean Oompa Loompas are Candy Elementals?"
"Actually, I'm thinking more like the Candyland board game. But, I like this idea better."
"I like the idea of Oompa Loompa Elementals."
Jeysie is offline  
 




 


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.