Fonzie's Tips on Getting started with programming
-
- Commando
- Posts: 2589
- Joined: Thu Jun 24, 2010 6:36 am
Re: Fonzie's Tips on Getting started with programming
Holy shit, bugdom and nanosaur!
Re: Fonzie's Tips on Getting started with programming
"Bondi Blue" iMac software licensing of Pangea Software titles revealed!
Now known as Nostal-gea Software (eh?)!
Now known as Nostal-gea Software (eh?)!
Either you are groping for answers, or you are asking God and listening to Jesus.
Re: Fonzie's Tips on Getting started with programming
Ruby:Fonzie wrote:meh, after you said something i went and changed mine up.
http://i39.tinypic.com/sq0bah.jpg
Its sexy.
Code: Select all
puts "Enter 5 numbers and I'll calculate the sum:"
sum = 0
5.times do
sum += gets.to_i
end
puts "The sum is #{sum}"
Even more fun way:
Code: Select all
puts "Enter 5 numbers and I'll calculate the sum:"
puts "The sum is #{Array.new(5){gets.to_i}.inject(:+)}"
I am no longer active to Halo or MGM, and don't guarantee a response on the forums or through email. I will however linger around the discord room for general chatting. It's been fun!
-
- Green Beret
- Posts: 3470
- Joined: Sat Jun 03, 2006 11:08 am
- Contact:
Re: Fonzie's Tips on Getting started with programming
Nitpicky, but true.
Also, HOLY HELL BUGDOM. When I used to have an old HPP desktop oh so many years ago, before I knew of this community, my dad would occasionally bring home one of the fruity-colored iMacs from the university. I remember I had to go behind the couch in that house, because that was the only place that had both an outlet and an internet cable (why, I don't know. I was young back then, I couldn't care). I would sit there for hours playing Bugdom, Nanosaur, and flash games on CartoonNetwork.com. Because apparently my HP didn't have flash, or was too slow to run them, or something. I just remember I never played those games on the HP, and now I can't remember why. I could never get far in Nanosaur, but luckily Bugdom was a bit easier. I think I actually managed to beat the game. There was also Cro-Mag Rally, but that wasn't nearly as fun as the other two.
Oh look, more musical nostalgia. If you ever played Bugdom for even a bit, you should remember this. As soon as I started hearing it, memories... Oh my.
I also remember playing MDK on his insanely old laptop. Anyone remember that one? That was a goddamn hard game. And even further back... In fact, you know, I think the first game I might have ever played was Asteroids. It was on one of these:
That thing is still sitting on a shelf back at home. We still have the charger too. Shame it doesn't work.
Also, HOLY HELL BUGDOM. When I used to have an old HPP desktop oh so many years ago, before I knew of this community, my dad would occasionally bring home one of the fruity-colored iMacs from the university. I remember I had to go behind the couch in that house, because that was the only place that had both an outlet and an internet cable (why, I don't know. I was young back then, I couldn't care). I would sit there for hours playing Bugdom, Nanosaur, and flash games on CartoonNetwork.com. Because apparently my HP didn't have flash, or was too slow to run them, or something. I just remember I never played those games on the HP, and now I can't remember why. I could never get far in Nanosaur, but luckily Bugdom was a bit easier. I think I actually managed to beat the game. There was also Cro-Mag Rally, but that wasn't nearly as fun as the other two.
Oh look, more musical nostalgia. If you ever played Bugdom for even a bit, you should remember this. As soon as I started hearing it, memories... Oh my.
I also remember playing MDK on his insanely old laptop. Anyone remember that one? That was a goddamn hard game. And even further back... In fact, you know, I think the first game I might have ever played was Asteroids. It was on one of these:
That thing is still sitting on a shelf back at home. We still have the charger too. Shame it doesn't work.
-
- Ranger
- Posts: 1894
- Joined: Tue Oct 16, 2007 3:57 am
- Location: "I didn't just take your mom out to dinner. I ate your mom for dinner."
- Contact:
Re: Fonzie's Tips on Getting started with programming
Ah yes, I did change it to 0 later, noticing it was off, this picture was taken beforehand.
Also I counter with this.
Also I counter with this.
Mota-Lev was here 30/4/2010@2:18pmG[v]N wrote:HUGE NOTIFICATION
THIS GRAVY HAS BRAINS
Re: Fonzie's Tips on Getting started with programming
WTF TAXI WHY HAVEN'T YOU SPOKEN TO ME ABOUT THIS. I KNEW THE CEO OF PANGEA, HE GOT ME INTO GAMING.TaxiService wrote:HOLY SHIT DUDEhttp://www.angelfire.com/nj/peanutbutter/pbj.html wrote:The song which should be playing is entitled "Night". It is taken from Bugdom (a game by Pangea Software).
HOLY SHIT
MY CHILDHOOD
Mota-Lev wrote:Its like watching an Asian girl crush a cats brain through its eye socket with high heels.. Its horrible but I just can't look away :/.
-
- Green Beret
- Posts: 3470
- Joined: Sat Jun 03, 2006 11:08 am
- Contact:
Re: Fonzie's Tips on Getting started with programming
Code: Select all
with Ada.Text_IO;
use Ada.Text_IO;
procedure age_thing is
ageTotal, age, derp : integer := 0;
begin
put("I heard you like ages, so Imma put ages inside of ages just for you. Or -7 to quit, whatevs.");
loop
get(age);
exit when age = -7; -- I love this command, btw. but thats the only one so far that I like in Ada
ageTotal := ageTotal + age; -- Ada doesnt have +=, :sad face:
derp := derp + 1; -- No ++ either! ARGH!
end loop;
put("Number of ages aged into ages: ");
put(derp);
New_Line;
put("Average age: ");
put(ageTotal/derp);
-- Yeah, without some more advanced command things you can't put variables
-- and strings into the same line. Herp derp. Also, no quote blocks, like C++'s /* Helloes */
end age_thing;
Re: Fonzie's Tips on Getting started with programming
Procedural programming is fun for simple things.
Draconic, MDK was really fun, but for some reason kept crashing on me, if I recall correctly.
Draconic, MDK was really fun, but for some reason kept crashing on me, if I recall correctly.
Either you are groping for answers, or you are asking God and listening to Jesus.
Re: Fonzie's Tips on Getting started with programming
My approach:
Nitpicking is important, especially when there is code that could be improved upon. I'll nitpick's Fonzie's code above soon when I get the chance.
Code: Select all
def get_ages
age = gets.to_i
return (age == -1) ? [] : ([age] + get_ages)
end
puts "Enter ages for people. Type -1 to stop."
ages = get_ages()
puts "Number of people entered: #{ages.count}"
exit if ages.count == 0 #Forgot to avoid divide by zero, edited this later in - so, there is no average age if this is the case
puts "Average age: #{ages.inject(:+) / ages.count}"
Last edited by nil on Thu Nov 17, 2011 10:33 am, edited 2 times in total.
I am no longer active to Halo or MGM, and don't guarantee a response on the forums or through email. I will however linger around the discord room for general chatting. It's been fun!
Re: Fonzie's Tips on Getting started with programming
nil, please give reasons why you prefer ruby over other languages.
Either you are groping for answers, or you are asking God and listening to Jesus.
-
- Commando
- Posts: 2589
- Joined: Thu Jun 24, 2010 6:36 am
Re: Fonzie's Tips on Getting started with programming
Ruby is awesome.
-
- Green Beret
- Posts: 3470
- Joined: Sat Jun 03, 2006 11:08 am
- Contact:
Re: Fonzie's Tips on Getting started with programming
Diamond was better. As was Silver.
Also, yes, nitpicking is a good thing. But try not to use too much of the advanced stuff if you do so. We are not at your level yet. The idea of using '+=' and starting at 0 is good, but in code this simple the idea of using 'for' or 'while' is debatable. To me, anyway. In more advanced code there is a definite reason to use one or the other, but I don't really see a reason to use one or the other in this one. Also, someone's choice language is simply that, their choice. They have reasons they like it better than other languages.
Fun fact:In a certain language, this code will output a single character you input. Anything more complicated then that I will not try to mess with quite yet.
Also, yes, nitpicking is a good thing. But try not to use too much of the advanced stuff if you do so. We are not at your level yet. The idea of using '+=' and starting at 0 is good, but in code this simple the idea of using 'for' or 'while' is debatable. To me, anyway. In more advanced code there is a definite reason to use one or the other, but I don't really see a reason to use one or the other in this one. Also, someone's choice language is simply that, their choice. They have reasons they like it better than other languages.
Fun fact:
Code: Select all
,.
-
- Ranger
- Posts: 1894
- Joined: Tue Oct 16, 2007 3:57 am
- Location: "I didn't just take your mom out to dinner. I ate your mom for dinner."
- Contact:
Re: Fonzie's Tips on Getting started with programming
^ Agreed, any modifications you nitpick must be explained so we know why you did it, and why it's more efficient, that way, we all learn!
Mota-Lev was here 30/4/2010@2:18pmG[v]N wrote:HUGE NOTIFICATION
THIS GRAVY HAS BRAINS
-
- Green Beret
- Posts: 3470
- Joined: Sat Jun 03, 2006 11:08 am
- Contact:
Re: Fonzie's Tips on Getting started with programming
Well, I can explain += and starting at zero.
These two lines are essentially the same. Instead of using '=', you can use '+='. It's meaning is simply "This variable is equal to itself plus whatever comes after the '+=. "
For starting at zero, well... It's just a computer thing. Everything starts at zero. When you start using arrays, in C++ they start at zero (in other languages you can define their range). It's just a consistency thing.
Code: Select all
variable1 += variable2;
variable1 = variable1 + variable2;
For starting at zero, well... It's just a computer thing. Everything starts at zero. When you start using arrays, in C++ they start at zero (in other languages you can define their range). It's just a consistency thing.
Re: Fonzie's Tips on Getting started with programming
I can point out issues in code while understanding that one is not using the more *different* approaches like I am. Exposure to different approaches and ways of programming is a good thing as well as exposure to different programming languages. One can choose to start with any programming language, but he should not limit himself to one. Just because one uses a particular language does not convince me that he actually likes it better than others, which is often the case when one does not have enough experience to make a proper judgement.draconic74 wrote:Also, yes, nitpicking is a good thing. But try not to use too much of the advanced stuff if you do so. We are not at your level yet. The idea of using '+=' and starting at 0 is good, but in code this simple the idea of using 'for' or 'while' is debatable. To me, anyway. In more advanced code there is a definite reason to use one or the other, but I don't really see a reason to use one or the other in this one. Also, someone's choice language is simply that, their choice. They have reasons they like it better than other languages.
+= is a shorthand like you explained, the benefit is obvious: less typing and code. I mentioned this before, though. I also explained starting at 0 as being a convention like you mention. I guess this is kind of a debatable point but many languages like starting at 0 and it often makes sense when accessing indexes or referencing memory and doing arithmetic on them.
I personally think for loops should be used in cases like:
Code: Select all
for (int index = 0; index < 5; index++)
{
//...
}
Code: Select all
int index = 0;
while (index < 5)
{
//...
index++;
}
In Fonzie's particular case, he just wants to repeat doing something 5 times - the counter is not actually important. Ruby offers a nice way of iteration for this scenario using closures as I showed above.
I am no longer active to Halo or MGM, and don't guarantee a response on the forums or through email. I will however linger around the discord room for general chatting. It's been fun!
Who is online
Users browsing this forum: No registered users and 1 guest