Programming Throwdown - BASIC
Episode Date: September 22, 2012This show covers Beginner's All-purpose Symbolic Instruction Code (BASIC), a starter language for many programmers. Tools of the biweek: Dungeon Crawl Stone Soup and Wireshark ★ Support ...this podcast on Patreon ★
Transcript
Discussion (0)
Hosting provided by Host Tornado.
They offer website hosting packages, dedicated servers, and VPS solutions.
HostT.net.
Programming Throwdown, Episode 19, Basic.
Take it away, Jason.
Hey, everyone.
So I just got back from Tahoe. For people who know Lake Tahoe is a
lake that sits on the border of California and Nevada. And is that right? I think so, yes.
I've done a lot of driving. But basically it's pretty fun. They have like a, you know,
you can go skiing in winter. In the summer you can go hiking and rafting and things like that.
And so we went rafting.
We actually saw a black bear that like literally jumped in the water
and started coming towards the raft.
And we started freaking out.
But he didn't make it all the way to the raft.
So he got about like 10 feet away.
And then he turned around and ran back. Lucky for all the way to the raft. So he got about like 10 feet away and then he turned around and ran back.
Lucky for all the inhabitants of the raft, I guess.
Yeah, exactly.
Yeah, we were wondering who we should feed the bear.
Well, the thing is you don't have to be able to outrun the bear,
just the slowest person.
What happens if you're in a raft, though?
If you're in a raft, you just have to be able to throw one person into the bear.
You have to be the most liked, the most disliked person.ed person it's a huge disadvantage you have time to take a vote yeah
you could pretty much vote someone i think it just makes whoever's the strongest right just throw
throw the weakest person off maybe but you can maybe be clever about it like hey get the camera
and then push them in or something you know when they're not looking so there's all there's there's
opportunity to be crafty here and save yourself you know as in many many dangerous situations in life oh man this conversation's not
going anywhere good so bears and rafting so we saw your death experiences okay so so first the
bear jumps this is why i don't go outside oh yeah stay inside look at these things on youtube
sometimes bears can come inside though you have to be careful i locked my brush so um so yeah so the bear jumps out from the bushes like straight out
of duck hunt or something like bear hunt that was that was a dog the dog comes out of yeah yeah
you're right in the ducks yeah yeah so straight out of bear hunt the duck hunt hack i don't know
so so then so we're on the raft and go a couple more miles and then take a guess
what jumps come flying out of the forest and and jumps in the river a salmon a car
like and and it really isn't funny but but no one was hurt so i guess it is funny but seriously a
car just like goes right veering off the road and just crashes like into the bank of the river like while we're on the raft um so were you
in a monty python real life experience like who is this so so windshields like totally smashed but
the people were okay were they in the car when it went i mean there was a driver in the car and
they got out and so it was pretty intense uh and then i'm never going anywhere at these places when you're around because apparently I've been rafting twice
and the time before a tree
a gigantic sequoia tree almost crushed us
so I think we're never
going to go rafting again
it's two for two crazy things
stay away from me
you want to go rafting?
no
unless it's on the Wii
that's right you can go rafting? No. Unless it's on the Wii.
That's right.
You can go rafting on the Wii U, which is coming out in a couple of months.
Oh, I didn't even realize I was segwaying.
So what's different about the Wii U?
So I haven't read too much about it, but I am posting this article.
And basically, from what I've read, the controllers have a touchscreen on them.
And so this, did you ever use that thing where you could hook up your Game Boy Advance to the GameCube?
Did you ever do that?
And they had like Zelda Four Swords and some other games?
Oh, okay.
So this was totally awesome.
This was way ahead of its time because nobody has four has four game boy advances right so the idea is like you could play this game called zelda four swords and you would use your game boy advance as connected to
the gamecube and on your screen you would have private information like the map which you're
revealing but but you don't want other people to see and so as you explore the map like as your
zelda character explores the map you start to understand where the switches are and how to get past the door and stuff but
you don't want to give that information out because you want to be the first one
to the finish so that game was totally awesome loved it the Wii U is going to
come out with games like that they've already announced they're gonna make a
Zelda pretty much like a four swords kind of kind of game so really looking
forward to it
you're gonna buy one awesome so you know i'm gonna do what i did with the wii where i'm not
going to be lining up at the door like killing myself you know to get one but you know after
like the hype has died down maybe like six to eight months the controllers come down in price
uh yeah i'll probably get one what about you no? No. You're not going to get one? No.
I mean, maybe when it goes to $49.99 or $100 or something.
How much is it right now?
It looks like $300.
$300?
That was what I just saw.
Oh, okay.
So, yeah, I mean, what I want is to be able to do that, but with my phone.
Yeah, totally.
So, like, I have a phone.
I have tablets.
Probably too many. And everybody I know has them as well why can't i do it with that yeah exactly yeah i feel like connect
over bluetooth or wi-fi or whatever and i feel like that would be super awesome yeah i mean i'd
give my right arm for just like something that would like hold my phone like have a little cradle
for the phone but it would be a gamepad.
They have those.
Oh, really?
Yeah, I think they're iPhones, I think.
Oh, man, where can I get my right arm?
Uh-oh.
They have, yeah.
Well, they even have the retro arcade cabinet thing you can put your iPad in.
Oh, I've seen that.
And it has, like, a joystick and the actual mechanical buttons.
Yeah, that was pretty awesome.
And I think it connects over Bluetooth.
Oh, okay.
So it's actually, so, I mean, I'm sure they have a gamepad or something like that. And I think it connects over Bluetooth. Oh, okay. So it's actually, so I mean,
I'm sure they have a game pad
or something like that.
I think I've seen them before.
Yeah, it just,
it has to be small form factor.
That's the key.
Or it has to like fold in on itself.
So like you can put it in your pocket.
Yeah, exactly.
Yeah, I mean,
I think there's going to be
some really cool things
coming out for gaming,
but I find myself
just playing a lot more casual games
than sitting down and playing it.
Just I guess where I am in my life, maybe,'t know i've been playing the sims free version on the
android phone and uh it's pretty wild so so this this sims you can't speed up time and everything
takes real time so it is kind of like farmville it's's true. But, you know. You have been hacked, sir.
You have been exploited.
Prepare for your wallet to drain.
Yeah, and it's constantly like, you know.
Because you can speed up time if you have money.
Yeah, that's right.
If you have money, you do it.
I knew there was a trick to this.
Yeah, of course.
So, like, I put all the Sims to bed at night, like right when I'm going to go to bed.
And so there's something kind of creepy but cool about that.
But then it's like, hey, you know, your Sims could stay up all night,
you know, gaining experience if you paid like, you know, a dollar or something.
To Chinese workers who farm them for you all night?
That wasn't, I'm leading into the next story.
I wasn't actually trying to be mean to Chinese people.
No, that's true.
Chinese workers do a lot of, provide a lot of valuable service to us.
You recently learned about that?
Yeah, and there's an amazing tech talk.
You guys should totally check it out.
I'm going to have a link to it.
And the tech talk title is The Voice of China's Workers.
And just supremely interesting story.
I'll just cover some of the most interesting parts.
One is all of them walk around.
Like all of the walk around like all
the workers they go home with to visit their families and stuff and they bring with them like
ipads and coach purses and stuff like that and like designer coach purses because they since
they work in the factory they get these at like ridiculous prices so like this lady she's the
ones with little blemishes or just like? Well, possibly. It wasn't said.
But, yeah, this reporter was like she had followed like several of these women who worked in a coach purse factory.
And, yeah, after six months, they gave her like just 20 or 30 coach purses and some other stuff.
And she's like, you know, no, give this money to your family.
And they're like, what are you talking about like this is like 13 cents or something to us you know and there's like 100x markup that same coach purse sold for like 1200 or something and so
just and they actually you know they're not oblivious they know how much the things are
sold for in america but they can't like there's no way for them to be able to sell them there yeah exactly and so they walk around saying like this coach purse sells for
six thousand like it's like the equivalent of like leaving the price tag on yeah yeah exactly
they leave the american price tag on like the purse the purse and stuff but they couldn't sell
it for a dollar i guess it's always the interesting thing right people talk about that we put so much
value on things in dollar amounts.
But then, like, if you're stranded on a desert island, like, that stuff's worthless to you.
Like, you don't have food and water.
And it's, like, it's really all relative, like, how much something's worth.
So, you know, if you're in China and there's nowhere for you to sell them and these purses are in high supply and they don't hold value.
You can't do anything with them except maybe, like, burn them for, heat yourself or try to like trade them for other like collect them all like pokemon or
something like this is not like i don't know like totally the the other interesting thing is they
a lot of them don't feel like they're being mistreated like the hours are harsh but but
there's a i guess in the chinese culture they're used to working like really long hours even when
they work in the fields like a lot of them come from from rural backgrounds where they worked a lot of hours there.
They said that the thing that they really want is education.
And then it's really hard for these factory workers to even like learn English and things like that.
Because it takes a lot of time. You have to spend a lot of time to learn.
Yeah. And there's just no opportunities like there's just no they don't have classes or anything like that.
And so I thought that was interesting.
And in fact, the beginning
of the talk was like, you guys are going to think
that these workers are oppressed
and they're just slaving away. But the reality
is that the things they want
aren't what you think they'd want.
And the whole thing is interesting. You guys should
definitely check it out.
And we definitely weren't trying to be mean to anybody.
No, not at all. And you can check it out by connecting your Raspberry Pi definitely weren't trying to be mean to anybody. No, no, not at all.
Yeah.
And you can check it out by connecting your Raspberry Pi up to your television if you
have one.
Did you get yours or did you never actually order one?
No, I ended up, so yeah, basically I just decided I was either going to get a Raspberry
Pi or an iPhone developer's license.
Okay.
Because they're both around the same amount.
Okay.
And so I just went with the iPhone developer's license.
Oh, okay. I see, I see.
Yeah, so Raspberry Pi, we've talked about these small devices before.
And they finally come into, I guess, wide-scale distribution
after having, like, a huge backorder
and not making them in very high quantities.
And so people are starting to come out with interesting projects.
And this one is a guy at a university, and his son built a supercomputer out of Raspberry Pis and Legos.
Awesome.
The son had actually been learning programming through one of MIT's more visual programming languages called Scratch.
I don't know much about it.
Maybe we'll have to look into it in the future and add it to the list.
Add it to Scratch.
Scratch.
And so they network network them all together they put all the you know high performance
computing stack on it things like mpi message passing interface yeah okay um things like that
and the interesting thing is they didn't have a lot of performance statistics that i saw in the
article reading briefly but what's interesting is that um you know it's very difficult for for universities
or small scale people to learn um the how to write programs for this style of computing so even if
it's not a top 100 supercomputer that you're building just having something that's more than
five or six machines but something that is like you know 20 30 40 machines and understanding where
the bottlenecks are and how to write code for that and how to optimize. This is very important to do, but it could be very expensive.
And so this person spent about $4,000, it said, to make this,
and it'll be an invaluable learning tool.
Now, $4,000 is a little bit much for a side hobby,
so it's probably hopefully for the university itself,
but it's definitely an awesome learning experience
and speaks to the interesting things you can do with stuff like this.
Yeah, this picture is amazing. you guys should definitely read this yeah so the built the racks and cases out of lego it's phenomenal it is it is really
cool um and then you know hooked them all together with it's amazing that the the circuit board is
like laid out in such a way where the lego could perfectly fit you know i mean that's yeah well
it's also interesting that it's like the scale, right?
Like how small it is that Legos are about the right size.
Like you don't need, it's like four or five Legos,
like three Legos in one dimension and like four Legos in the other.
It's like not a lot of Legos that you need.
Look at the power of that.
This is so awesome.
We can see that Jason read the stories in advance.
I'm totally busted. So, yeah, this is so awesome. We can see that Jason read the stories in advance. Totally busted.
So, yeah, this is very interesting.
And the other thing I'd be curious is people doing, and I've seen some stuff similar with Amazon, their cloud computing, right?
So, you know, bringing up a bunch of computers there so you can practice and do large-scale supercomputing style work and kind of learn that work on it.
Actually, along those lines there's
this thing called a common crawl have you seen this no so common crawl is a 60 terabyte snapshot
of the internet and uh so what you can do they have actually have code contests constantly with
different themes which is kind of fun but um if you have an Amazon account, which if you're a student,
you can get one at a discount or even free,
you can write sort of algorithms that work on the entire Internet,
and they run on Amazon EC2.
And so Common Crawl is a way to sort of make it easy for people
to write things like, oh, what's the co-occurrence
matrix of every word on the internet or oh like let's try and do something cool with like all the
twitter you know data that's public or you know things like that so um they they do a lot of fun
stuff you guys should definitely check out interesting yeah that sounds cool it's another
way to sort of like teach people about, you know, super parallel programming.
Yeah, I mean, big data, right?
Like I guess that's the buzzword for it.
But it really is important.
We see it out here being where we are in California.
Everybody, everything is all about big data.
Billboards on the side of the road.
Yeah, it's crazy.
But it is true.
Like you have to take special care when you get into data that starts off the
sentence like, for every website in the web, count the number of times a word occurs.
How do you handle that?
What data structures do you use?
This is very valuable.
And it is a good skill to have if you're trying to learn stuff.
Yeah, totally.
Totally.
So our final news article is kind of a little bit silly.
But somebody wrote about making a Turing-complete computer
using three Magic the Gathering cards.
So Magic the Gathering brings a little nostalgia for me,
is a collectible card game.
So it's a card game that has all these different kinds of cards,
and some are rare and very rare, and some are very common.
And there's a set of rules, and basically you try to build up a deck that's your favorite deck.
And you play your buddies with your cards and see who's the best or whatever.
This was before the internet was really big.
Well, maybe it was different than it was today.
So we had to spend time outside.
Did you get into it?
So into it was different.
I never like, so it can be very expensive to acquire the very rare cards and stuff.
Although they've gone up in value.
Like I kind of wish I had bought them and then sold them today.
But we would play.
We would go to the store that sold them and buy the pack of common cards.
The box of 400 for $5.
And then we would just play games, me and brothers and I.
I did the same thing at school.
The really cheap stuff.
Our decks were horrible, right?
But it didn't matter because as long as
everybody else's deck is horrible,
it's still fun.
If you've never heard of it before, you can check it out.
They recently released
a program
for Magic the Gathering that has
a lot of cards in it and hosts games
online. I think they have an iPad, iPhone.
It's actually, considering how
much it can be to buy a real deck and play it, it it's it's fairly affordable is it you have to pay per card
so the way i think it works is like you can buy pre-constructed decks of cards or you can pay
for like random things similar to like buying booster packs or whatever um which is kind of
interesting maybe we'll have to talk about gaming sometime because a lot of cool games but uh so
this person found essentially Turing Complete is
named after Alan Turing, who showed that there exists a
computer that if it can do a certain set of routines, can
perform any computing function.
It can compute anything that's possible or whatever.
So it's essentially showing that if you have a programming
language or a computer that's Turing Complete, that given enough time and possibly infinite time, it can accomplish any given computing task.
And so this person had three cards with unique properties that involve counters.
And the idea of a Turing machine is it's a tape head moving on an infinite tape and kind of storing data in one place and then having an instruction that tells it what to move left or right
and then what to do when it gets there, that kind of thing.
And so they were able to do that with these three cards.
It was kind of interesting.
It's kind of silly, but it's kind of fun to read about.
Yeah, it's amazing.
Yeah, I see what people do these things every once in a while,
build a working computer out of Legos or ball bearings
or Magic the Gathering cards.
Did you see the one in Minecraft that was made out of Minecraft animals and water?
Oh, I haven't seen that one, no.
I've seen the ones where they use the,
what is that called, the redstone and make the wires.
And actually, people built a game.
So it has a giant screen that displays stuff
and has a graphics processing unit and everything.
That's awesome.
Oh, man, it's such crazy.
That's great.
I guess that's one of those things that
people say about guitar hero whatever like if you spend that much time playing guitar hero you just
learn to play real guitar that's not exactly the truth but it's the same thing like oh you just
spend that much time like creating minecraft things like that's crazy like it's awesome and
it's dedication and they're having fun so more power to them like i don't think but it's like
wow like i wonder what other stuff you could do with that much time like yeah i noticed i was watching a youtube video the
other day where somebody had a like a minecraft i guess you could export your world and like send
it to people and they can import it and this guy had made a world which was like a rpg and you had
to like the thing is the onus was on you to follow the rules like of course you could just punch your
way through the wall and be done but like assuming you followed the rules like, the thing is the onus was on you to follow the rules. Like, of course, you could just punch your way through the wall and be done.
But, like, assuming you followed the rules, like, it was just, like, pretty fun, like, semi-random, like, RPG.
And I thought that was awesome.
And so I think there needs to be, like, a database of, like, Minecraft worlds.
There probably is, dude.
There's, like, everything.
So it's so interesting, Minecraft, that the guy Marcus Pierce.
Is that Marcus Pierce?
Yeah, Marcus Person.
I don't know.
Okay.
They call him Notch.
Yeah.
You know, he, like, made something that, you know, took him some time and work.
And he's kind of become famous.
But a lot of it is due to the openness.
Like, not just the game is an open world, but, like, it's open to modification and sharing levels and hacking save games and creating macros.
And he kind of incorporates stuff that people do
and brings it back in.
And now he doesn't actually work on it anymore.
He has his team works on it or whatever.
He does other stuff.
Yeah, he's working on that space sim.
The space one, yeah.
I don't know how you say it, but you can look it up.
And it's kind of similar.
So it's interesting that he embraced the openness
of the community so much
and that they've really kind of embraced him back.
And people see these crazy YouTube videos and then go
buy a copy of his game, right?
Yeah, I was thinking about getting it for the phone. I just don't know how
good it's going to be.
I have it for my Xbox. And the cool thing about
the Xbox is, since the game really
is meant to kind of run in like 640x480
or 800x600, because it's really
pixelated and blocky, so you can make it bigger
but you're not really getting any
more data on the screen.
And so I have like a nicey so you can make it bigger but you're not really getting any more data on the screen right um and so i have like a nice tv you know hd resolution and xbox can push that so you can actually play four players simultaneously on one screen like sitting there with xbox controllers
and you although your screen gets smaller right like you still have the same data that's on there
yeah so it works pretty well so that's cool play with people sitting in the same room which is kind of fun.
Yeah, yeah.
That's great.
But I don't have it
on my phone yet.
Yeah.
I'll probably get the demo
maybe today or tomorrow.
All right.
So if you don't do any work
for the next week or two.
Actually,
so the reason why
I don't have it on my phone
is because of our
tool of the buy week.
Uh-oh.
Tool of the...
We didn't say it in sync.
Okay.
Continue.
Our three tool...
Oh, I missed it again.
Okay, just continue.
Just go.
All right.
So my tool of the bye week
is actually game dungeon crawl stone soup.
Are you going to waste more of my time?
Like, am I literally going to risk getting fired
for not doing work?
This might cause you to get fired,
but it'll be worth it. You'll be a happy'll be you'll be how can you determine if it's worth
it for me actually worth it might not be the best choice of words but uh so this i picked this for a
number of reasons uh one is um it has an awesome tutorial which is something that like roguelikes
which this is a roguelike um are notoriously bad at like if you go to play nethack
it starts off you know pick your role pick your race you don't know what any of them really are
and then it's like go yeah try dwarf fortress yeah dwarf fortress is the worst i would kill
to have an awesome tutorial they have a book that people are like raving about that like it's so
it's kind of crazy you have to read like a book. Textbook. It's like a Dwarf Fortress for idiots or something.
It's like an O'Reilly book.
It has an owl on it.
No, actually, I think it is O'Reilly.
But it's not an owl.
All right, I'm going to look it up right now.
But I'm really tempted to buy it because everybody who gets in this game just says it's amazing.
Like all these really famous people, like even Notch, right?
Like the guy who made Minecraft.
Like he took inspiration from like it's so.
Dwarf Fortress is my favorite game of all time for people who don't know um it's amazing but yeah you're a gigantic learning curve yeah i really
want to get into it but it's like i'd have to invest so much time just to get started and then
like that's only the tip of the iceberg then i'm gonna spend tons more time yeah exploring the
reason why doorforge is great just if i had to say it in one sentence it would be you know it
takes like the best of minecraft which is a creative like building part but to say it in one sentence it would be you know it takes like the best of Minecraft
which is a creative like building part but it puts it in an environment where you really want it it
puts it in a sim like like in Minecraft you have to actually walk across the map right or like you
have to build a house and you know what you want to build but you have to click on all the blocks
right so door forges you can lay out like a little floor plan and give orders and then your guys can go around you know doing these little orders and also it has permadeath
you know because you have all these dwarfs and you're getting like a new supply of dwarfs
if you make a mistake like you dig too deep and there are monsters you can't handle
um your dwarfs die and so that permadeath gives you like a level of suspense i feel like you don't really have as
much in minecraft so um so the game the book is called getting started with dwarf fortress by
o'reilly i've heard good things about it like people like it's supposed to be really really
good so if you're interested in dwarf fortress and like wasting i'm months of your life definitely
buying that book if you do let me know how it goes yeah i'll loan it to you okay all all right there you go there you go no please don't my wife my wife might like not be very
happy with you or me it's also not not just marcus person yeah here's a per anyways yeah so we're
probably saying it wrong but we're giving them credit so back to your topic which i totally
derailed so uh yeah no worries so this has dungeon crawl stone soup
has an amazing tutorial and it teaches you about you know getting started with the game the
different keys you know um some things a lot of people play net hack and slash them these roguelikes
the thing they don't realize is if you um hold shift and you move a direction your character
will walk that many steps until he either like hits a wall or hits like
something interesting and so a lot of people don't know that and so they keep hitting like left left
left left and they're just wasting a lot of time you know because the game is like kind of turn
based it's like designed for you to be able to sort of macro and there's all these macros
and they're all common across all these roguelikes so dungeon crawl stone soups a way to sort of
get you in there and get you like working in roguelikes playing roguelikes like at the pace they're
meant to be played and just getting like a ton more fun out of your roguelike um on top of the
tutorial it's also just an all-around great game like i haven't played a lot of it yet but um
has like a wide array of different spells and abilities you can use and races and classes and
yeah i've heard good stuff about this as like an introduction to roguelikes yeah it's supposed to be really good but it's also really
deep right yeah yeah definitely i have it on my phone and uh so it's been it's been pretty fun
i'm looking at the screenshots and how deep and cool the nerdy this looks there's something
appealing i don't know what it is like right something that looks very difficult and very
nerdy and like elitist like you want to do it just because like you want to it's like what do they call it wearing the hair shirt or whatever yeah
exactly it's like you want to put on the thing that's itchy and bothers you just to like prove
like yeah i am elite nerd yeah exactly yeah the um the uh they post the high scores and they post
a list of all the people who have completed the game online so that can get pretty addictive like
you want to be on that list.
I don't think so.
Oh, really?
I think that's like, you make it there,
and you feel so proud of yourself for like a day.
And then you look at it, and you're just like, ah.
It's like getting the high score on an arcade game
until they reset it, right?
I'm still proud of, so NetHack has a server of it,
like this sort, too.
And I've ascended in NetHack on the server,
and I'm still proud of it to this day.
Like, I still, every now and then I look back,
and I'm like, yeah.
Good job.
Good job, sir.
Pat on the back.
And Slashem, which is a harder version of NetHack,
also has this.
And I've tried, you know, on and off for half of my life.
I've never done it.
Never ascended in.
One time I went, like, halfway,
which, you know, is like 40 hours of gameplay
I don't
by the way
if you're a game developer
or thinking about
becoming a game developer
please stop putting
how many hours
I've played your game
oh I know
please stop
it's so bad
please stop
don't do that
Steam does that
on all the games now
and it just makes me
depressed every time
I look at it
yeah
okay
my tool of the bi-week
is not a game.
It's Wireshark.
That's a great tool.
So Wireshark used to be called something before.
Ethereal?
Yeah, that's right.
So this is the kind of thing that you either love
and you use it all the time,
or you hate and you've never used it before,
or you get into a bind
and you don't know how to do something or what to do,
and then you use this.
And that is,
any time you're going to do network programming,
and it's so hard to tell what's happening when you try to open that socket
and it just doesn't work.
You don't know if packets are getting there.
Are they malformed?
What's going on?
And Wireshark is kind of the answer to that.
Or if you're using BitTorrent and it's telling you,
hey, your port is closed or whatever,
and you just can't seem to figure it out, Wireshark will tell you, oh, you have packets
coming out of your computer, so it must be somewhere else in the chain.
Yeah, so what Wireshark does is it puts your Ethernet port into a mode where basically
it can read all of the packets you're getting along with everything else still getting the
packets like normal.
So everything acts like normal, but Wireshark is getting a copy of all the packets as well.
And then what it does is just kind of displays like a hex dump of the packets,
like the header, the information, whatever.
But then it has these processors that get layered on top to understand like HTTP traffic.
So like, oh, this is a get request, you know,
and it'll actually like try to kind of tell you in an
intelligent, readable way all of those
things that you might want to know about
that kind of information. And it's just one of those
things like if you need this, it's just really valuable
and works really well. But it can be
it's like a power users tool, like
90% of people probably never
who do a lot of computer programming never
use it and never get into it, but you know
it can be really helpful and it's good to know about.
Yeah, definitely.
Especially if you're doing any kind of network development.
Yeah.
I mean, if you're doing it.
I made that 90% up.
No, I'm thinking about it.
I have no idea what percentage.
Like 99.
I don't know.
Okay, sorry.
But, you know, it's awesome.
I wrote a peer-to-peer app, and Wireshark was, like, crucial.
Because, I mean, you know you it was sort of kind of like
based on a heuristic who would connect to who and things like that and wireshark like explicitly was
telling me oh you know these ports are talking to these ports you know on the same machine and
things like that so so uh if you're doing any kind of network programming this will save your life
yep save your time all right time for basic history of BASIC is that it was created
in Dartmouth College out of a research paper. So some programming languages are created by
programmers and some by researchers who I guess could be considered programmers as well. But
we're kind of doing research topic and we're talking like way back in the day. So what we're
saying is like the 60s or pre-60s, like in the 50s. Yeah, totally. We should get the year.
I think like the early 60s.
I'm totally unprepared.
I'll look this up.
It's okay.
And it was based on a paper.
1964.
1964, all right.
And so it's called
Beginner's All-Purpose Symbolic Instruction Code.
That's what the acronym is.
The acronym, so basic.
And the whole idea was that, you know,
there were programming languages at the time,
but it all
kind of like assumed you were like a hardcore programmer like you wanted to really get into
this and this was supposed to be accessible which i i mean i think it succeeds at yeah like i mean
like it trying to and this is something we talked about a little before we started the show jace and
i both have we'll get to him in a minute you know experiences with basic but i mean this idea this
romantic notion of creating a programming language where you just describe in English sentences or insert whatever language you
speak, a native language, you know, just normal conversational text to a computer and have it do
what you want. I mean, this is like the Jetsons, right? You tell Rosie, like, hey, I need this,
right? And you just speak to the computer normally and it decides what to do.
Yeah. Yeah. I mean, you know, there's, you can't get more accessible than, you know, it being your operating
system, right?
Like, you turn on the computer and basic starts, you know?
Yeah, so that was the way, you know, Commodore 64s, TRS-80s, Apple IIs, right?
They boot them up and they just were in a basic interpreter.
And it worked well for that because you could say things like, it wasn't print def or see
out or what are these things.
It was like print.
And then you just gave it, you know, this thing you wanted it to print.
And then the next line, so you say print hello world.
And the next line, go to previous line, right?
Go to 10.
10, print hello world.
20, go to 10.
You know, yeah, if you think about it, go-tos are, so, you know, you hear all these things like go to is evil and all stuff and then somebody proved that you know this wasn't a hard proof or anything but that you could basically like if you use for
loops and breaks and returns um you can like take any program that has go to's and turn it into
for loops and breaks so go to's aren't necessary yeah so yeah they're not necessary and they're
also not evil like you could do the same thing you could do you could do equally evil things without using go to um but but there's there's a appeal to it you know the idea that
like i'm going to label this line as like line eight and then somewhere else like go to eight
like it's so much more intuitive than like a for loop where you have to like count up and each time
this i has a different value and you know it might not be the most useful but for someone who's just
starting out it it makes more sense like they look at that and they know immediately what's going on yeah it
is true i mean the for loop concept takes a while to get around you just kind of have to get to that
epiphany stage like oh i get it now yeah and i mean the whole issue that as programmers we
understand is you need to be able to be very precise to the end and actually saying go to
this line i mean that's like very
if you say return it's like return to what an early basic didn't have
functions or procedures it's just you know straight down the line imperative
programming just you know yeah actually we should mention that we're not
covering visual base yes okay we'll go through so like the first generations of
basic right like there's you had to have every number lined.
There weren't procedures.
You could do these go-tos, and you could have kind of Boolean statements or whatever.
Yeah.
So for people who don't know, the way the computer, and Patrick will probably know a lot better than I will, so I'll let him correct me.
But the way I understand it is you have a program counter.
So if you have a multi-threaded.
The CPU has a program counter. So if you have a multi-threaded... The CPU has a program counter. The CPU has a program counter for each thread,
which says what instruction that thread is on.
Or in the case of BASIC, you just have one,
which is for your thread.
And so the program counter keeps stepping through
until it encounters a branch.
So a branch might be an if statement.
So if something is true,
then you're going to go to the next program counter.
Otherwise, you're going to skip all the way down to the end of that if block, right?
Or a go-to is an explicit branch. You're actually saying, you know, take the program counter and set it to this other instruction.
Well, in BASIC, it makes that, like, very explicit.
Like, in the first version of BASIC, you literally wrote the program counter for all of your instructions.
Yeah, well, so you write the memory location essentially is what you're doing.
So we say 10, and that's like a line number, because line numbers don't have to be sequential.
But you're essentially kind of stating like this is an abstracted version of memory.
So the processor would just execute the first memory instruction, then go to the next one,
and go to the next one, until I encounter, like you said, one of these things which said,
affect the program counter in this way.
Change it to this, or minus one, or plus one, or whatever.
And so basic, yeah, you had to put the line numbers there
so you knew where you were, and they had to be increasing
so that you would keep moving forward in the memory
and going up, unless you did a go to.
And then the second generation,
oh, we should say that Microsoft got its start
in creating a version
of BASIC and
that's kind of where they started. So we won't get into
that large history. I don't know
if this is still true but the last time
I checked which was XP
it actually has QBASIC
in it. Like if you just
scan your whole computer for QBASIC.exe
now I don't know anything about Vista
or 7 but I know
like 98 and XP in these
2000 actually had QBasic and
they actually in the same
directory there is a
bananas.bas and
it's a game where you're like a monkey
and you have to throw a banana.
It's a game written in QBasic.
I don't believe you. I'm going to go try that.
I'm going to go try this right now.
So that was the first generation of Basic.
And then the second generation came out.
And this is Quick Basic, like you're talking about QBasic.
This is where this came out.
And these, you didn't have to put line numbers
if you didn't want.
You could have more just labels as opposed to line numbers.
And then you could actually have procedures,
essentially functions.
You could go to a function. And then like we said said that notion of return from a function is kind of vague like
where are you returning to well it depends on where you came from so when you say go to you're
going to a line and then you have to later you say go to some other line like you it's not just
like go the return is go to something that was stored previously and that's the the stack so
the stack will store have Have we talked about stack?
No, I don't think we have.
All right, why don't you cover it?
I think you'd be an expert on this.
So for people who don't know, Patrick majored in computer engineering,
and I majored in computer science.
And then that alone makes him, like, much more applied
and know things which are useful.
I mean, no crazy five-minute time.
I think we're overstating this.
But then, like, on top of that, I did all theory.
Like, I tried to stay away from all the
like databases and networking and so that makes me even more even like less useful when it comes
like close to the metal stuff so so patrick okay okay so a stack is a data structure but also it's
something that is represented in the hardware in cpus. And it is what's called a last in, first out data structure.
So this implies that the last piece of data that you gave to the data structure,
when you go to get something from it, it'll be the first thing that comes out.
So think of it as like, it's called a stack.
It's like a stack of papers.
If you put one paper down, then put another on top and another on top,
when you go to pull that last one, to pull the one on top,
it's the most recent one you put there.
So if you think about functions, that's the way it works.
So if I have function A calls function B calls function C,
when I return from C, I want to go back to B.
And then when I return from B, I want to go back to A.
So I want to go in the reverse order that I just came.
And so that's what this return does.
So you need somewhere to stick this address of where you came from,
the stack, the pointer, the program counter of where you came from.
So you stick it on one of these stack structures,
and then you go to your other function.
And then when that function finishes or calls another function,
but when it finishes and returns, it takes the thing on the stack
and goes, jumps to that location.
And hopefully if everything worked out right and nothing bad had happened,
you'll go back to where you left.
So if you were in function A
and you called function B, it did its magic,
and then returned,
then you'll be back one line past
the line where you called function B and function A.
So that line plus one.
And that's also how things get passed to functions.
So you also stick the things,
the parameters you're calling the function with,
you stick them on the stack and they get popped back off too. So that's how things get returned
as well. So you can get the results of the function as it were. And so that's what the
second generation did of BASIC was add these procedures and allow for procedural programming,
which comes before object-oriented programming, which is what the third generation attempted to do and that's where you get
things like visual basics of VB script which is a way to script Microsoft
products maybe others as well I don't I don't know the licensing agreements
there and like visual basic net yeah and these kinds of things they try to
introduce the notions of object orientedoriented programming to BASIC,
but we're not really going to talk about those today.
This is a nostalgia trip.
Yeah, totally.
I mean, VB.NET has all sorts of awesome stuff in it,
and we'll cover it in another show,
but today we're going to just focus on BASIC.
So, you know, we both had experiences doing this,
and it's one of the things that I consider programming and basic to not have been really programming
Oh, it was and it is but I fooled around with various, you know, like I said print
Oh, I guess I didn't say this on air
So it's like, you know, my first program members like 10 print Patrick rules 20 go to 10
execute right and then
Like all the way down and And then you call in your brother, hey, look, man, the computer knows I rule.
We would have this arms race.
So my cousins were all kind of techies, and most of them were older than me.
And so we all had the Commodore 64 manual,
and we used this as sort of a way to see who the alpha programmer was at the time.
So someone started with the
you know 10 print you know lin rules 20 go to 10 and my cousin was like check it out you know
and then i figured out a way to uh like print mine so that it like moved it like kind of bounced left
and right on the bottom of the screen because like it just go back to 10 but it put a bunch
of spaces in front and so it looked like it was kind of bouncing and then
like another one of my cousins found out you could actually write to specific places on the screen
like you could say i want like this row and column to have like a letter in it and so she actually
made her name like bounce like as if it was a little pong ball or something yeah yeah it was
super fun so i mean but that kind of encouraging that kind of fun experimentation
is really a good way to learn you know it takes it's still another leap to go to programming as a
you know getting things done kind of thing um but those those early lessons are valuable
and the fact that it's so approachable basic was for kids like it's it's easy to get started in
and even though you might move on to other stuff those those early lessons you know about you know oh i want to move but then i want
to go back at some time so i need some sort of loop that's counting right you're introducing
kind of even if you don't know what you're learning these four loops and then later when
you learn the proper concepts you can map them back to those early things that you were doing
yeah i mean i noticed that like i've taken a lot of different classes and things
like just on the web like i'd recently took uh rails for zombies have you seen i have seen that
one yeah i took this class and uh and pretty much nothing's now you're a zombie yes brains rails so
nothing stuck and like when i went to make a i'd recently made a website in rails i forgot
everything like everything i had to go back and relearn and the thing is when you are like when you have a vision in mind whether
it's printing your name over and over again or making a website or whatever and you're learning
something as part of fulfilling that vision that's when it seems to stick you know it's so much more
effective than trying to learn something through a class or something like that and basically gives you the ability it's easy enough where you can start with zero you know like you can start
not knowing anything about programming and just have like a vision of oh i want to make like a
little dot move around the screen or something i mean you can't have a huge you can't say i want
to make you know quake or something i was just thinking quake that's awesome or you know minecraft or something
or fortress yes maybe actually that might not be out of that but anyways so um if you if you have
the book apparently so yeah i mean but you know if you have a like a simple vision you could start
with nothing just start typing in basic and every time you can't do something you look it up on the
internet and make get your way through it and you'll be incredibly fulfilling
learning experience so I mean we in some ways I guess as programmers you move on
from basic but I mean there are a lot of people who get valuable paying jobs you
know just writing you know essentially basic style things and that's great and
it is amazing that something
that was written so long ago kind of still sticks around, even if it's not vitally important,
like it once was, you know, it's still with us. Like we all have fond memories of it. There's
still, you know, things you can find, we'll talk about later, like on the internet or whatever,
you can just find versions of it free that keep being updated. And every version of Windows
apparently was shipping with a version of basicASIC. Yeah, totally. Yeah.
I mean, there's, so there's VBA, which is Visual Basic for Applications.
And it actually started off as just, I guess, BA.
But like in earlier, really early versions of Excel and stuff like that. And you would just write BASIC to, you know, manipulate the cells and things like that.
And there's people who, as Patrick said, just do this even to this day.
Yeah.
I mean, so we traditionally go through like strengths and weaknesses. I mean, we things like that. And there's people who, as Patrick said, just do this even to this day. Yeah.
I mean, so we traditionally go through, like,
strengths and weaknesses.
I mean, we can do that.
It's a little strange for this one.
But it's so, like Jason said,
so easy to sit down with essentially a blank line and get something to happen.
And that's really rewarding.
Yay, I made the computer do something, right?
Like, I programmed it.
And that's amazing.
And that's in part due to the approachable syntax.
I mean, it does read a lot.
Like we said, instead of like printf or cout, it's like print, go to, if, right?
I mean, these things are somewhat more understandable and closer to what people know already in their, you know, normal way of communicating.
Yeah, and something that I just remembered uh when i was in college there's
this guy who was going crazy over dark basic dark is that like the vampire basic yeah it's sort of
like rails for zombies oh there's a lot in common but so dark basic is um i think it's commercial
uh let me see you you write games in this i i think i do remember this yeah so i actually allow
you to do like graphics programming and stuff.
Yeah, I'm not sure if it's free or not.
But basically it's a way to get access to DirectX,
which is Microsoft's, like, rendering library, like, or rendering platform.
And so you can write basic programs,
but instead of just kind of printing your name
and doing cheesy things that we were talking about,
you could actually, like, create, like, little sprites.
You could load images and have them like move around and so for people out there like budding game designers and and people want to sort of like write a game really quick but have
no experience in programming you should definitely check out a dark base yeah i remember i mean those
were the first games i wrote not that i've written many games but you know something like you're
talking about but i actually like there was a way to draw to the screen.
And so I would learn about, like, erasing the screen and then drawing a little square
and making it bounce off the corners and learned about flipping the velocities, right,
which I didn't know was a term, but, like, oh, I need to move five pixels to the right.
But when I hit the screen, I need to know where the screen's at,
and then I need to make that negative and move plus minus five pixels, right?
And, like, learning how, like, that's how that works and figuring it out and that sense of triumph you have and then also
I mean like try to make like a little pac-man thing where the mouth would open
and close only instead of using which later learn yet they have sprites to do
that right like just various animation I would actually draw like a pie circle
like with the angle and then the angle would get smaller and bigger right kind
of go across and yeah you don't any difference, so you just make do.
So this is kind of like a little segue here.
But I was reading this really interesting article on –
I've been doing a lot of drawing lately, as I mentioned a while ago,
maybe in an earlier episode.
I have one of those Wacom tablets, those USB drawing tablets.
And I've been reading a lot of books and papers on
drawing as well.
And one of the things that I thought was just fascinating, and I didn't believe it until
I actually saw examples of it, is if you have two frames, so imagine like you have one frame
where Pac-Man's mouth is open and another frame where his mouth is closed, and you just
like flip-flop between these two frames, it will look like weird and cheesy and it won't look
right but if you have three frames or i guess in this case five frames so you have like mouth open
halfway closed closed halfway closed open like if you just add that third frame there's something
in your brain where your brain can't remember three frames back and it looks like fluid motion
like this sounds crazy but if you just google that or
something or maybe i'll post a link on the blog they have examples where they show like a kick
so almost all of the street fighter 2 is like three frames like all the kicks and punches
like it feels really fluid but it's just three frames and they take out the middle frame
and just it's just dramatic like you look at this and you're like this is garbage i guess it makes sense because you're the guy's standing there not punching and then the arm is all the
way out but you don't really know how it got there yeah but if you draw one in the middle like
yeah it's just kind of your brain is interesting yeah it's just shocking like three is like the
magic number and it's based on some psychological or neuroscientific thing yeah so so weakness is
a basic we've been singing the praises of basic yeah so be the bearer of bad news yeah sadly basic is not going to let you
make you know quake 3 yeah it's uh well you know maybe dark basic will but of course you're
leveraging all those c++ libraries but you know basic by itself it's just uh not only because
it's interpreted because we've talked about interpreted languages before but specifically basic just kind of the way
that it's designed with like no you know stack frames you know
stack frames you have to like manually you know manage that yourself and
there's a lot of other reasons it'll never be like high-performing the other
thing is it doesn't have a lot of the bells and whistles that would
make your life easy as a developer. So it doesn't have multi-threading, it doesn't have object-oriented
paradigm. So, you know, it's not going to let you make that killer app. You know, at least
it's going to teach you what you need to know to get there. Yeah, it's definitely started uses.
Yeah. And then tools, like we said, there are many versions of Free Basic that are around.
It's actually really hard to search for basic, as I found
out, because basic programming, and then they just
talk about introduction to programming.
It's like, no, I want basic programming, not simple
programming.
So it is a little hard to search for.
But you can find information about it.
And there are many web-based versions, free interpreters to
download, and it's still a great thing to start today.
I think if you have kids or you do one day, I think it would be a great way to introduce them to programming.
And like I said, this is how my earliest programming was done in BASIC.
Yeah.
And BASIC is, I don't know if this is still true.
It probably is.
But it's in all the Texas Instruments calculators.
So when you get that fancy scientific calculator in seventh seventh grade or sixth grade wherever they start requiring that
um you can program in it you can make games in basic as we both did yeah so we were actually
talking about this so getting one when we were in high school i had a ti 83 i think it was
but i think even like 82s and i don't remember all the numbers now yeah okay they yeah they had
a version of basic and you had to type on the, like, keys weirdly to get the letters.
And somehow, like, I guess as crazy as we think it is,
people doing the SMS messaging on, like, the 9 or 10.
Yeah, the T9 thing.
Oh, man.
But people doing the same kind of thing.
We were doing that on calculators.
And, you know, it started off like, you know, a math class.
Our teacher would say, like, oh, you know, you couldn't, like,
eventually there was a way to download from the internet,
you could download programs and run them.
But if you could program something yourself,
you could use it for geometry to compute
the hypotenuse of a triangle.
So we'd code in simple formulas into our calculators.
And then eventually, yeah, I wrote,
both of us turned out, we wrote a little RPG. It like a little turn-based fighting game where it was generating random numbers and deciding if you would hit the guy or not.
And you just like really simple things.
But, you know, you learn a lot.
Yeah, totally.
I mean, the other thing is we had this awesome arms race in our math class.
So, for example, we started writing programs to solve a lot of the geometry problems. And then the teacher,
she caught on to it. And she was cool with us writing the programs. The problem is that they
were getting into the hands of like all the students in the class. And some students like
were just using the program. They didn't really know what was going on. They were just putting
in the answer. So she decided that she's going to like make you wipe your calculator. But I didn't
want my calculator to get wiped
because I had all these games on it that I was working on.
So I wrote a program that looked like the wipe your calculator screen,
but when you hit it, it didn't do anything.
And then when you're in middle school or high school, you want to be cool,
so I started showing it off, and other people started writing it.
So then we all had the program. then the teacher found out about the program and so they didn't ended up with this arms race of
like could you keep your stuff on the calculator yeah we didn't have that but
we did have people who like learned you like she would allow the teacher would
allow maybe I don't remember now would allow programs but they wouldn't actually
write programs they didn't know how or didn't care to learn.
And I wasn't about to get in big trouble or lose my ability to use it,
so I wasn't going to share.
I guess I'm meaner than you or something.
Man, so you ran like a geometry program mafia or something.
No, no, no, no.
I just wouldn't share it at all because I wanted to be able to use it.
Oh, you didn't have the circle of trust?
No.
Like the circle was just you? Yes. There's's a point i was the earliest google plus with only me
um and so uh yeah but people would just instead of writing a program they would just write
like a cheat sheet in the in the code right so the code could never run it wouldn't work
it would just like write out all the formulas and equations and everything yeah the teacher
in spanish class is like, wow
these kids are using math to solve
Spanish.
Oh man, that's pretty funny.
So this hasn't been an especially serious
version of Programming Throwdown, but it's a trip
down. We had some heavy episodes and we
had Go, which is like heavy systems
programming, like you know, coroutines
and all that stuff. And we had Java which is like so much stuff in like, you know, coroutines and all that stuff.
And we had Java, which is like so much stuff in Java.
So we wanted to keep it light this time.
Yeah, have some fun stuff every once in a while.
Yeah.
There are a lot of programming languages out there. So we've got to cover the fun ones sometime, too.
Yeah, totally, totally.
All right.
Well, thanks, everybody, for kind comments and emails and Google Plus replies.
And we went through a little bit of changing with the servers,
which was fun for Jason.
Yeah, I thought I could host programming third under my house.
So thank you all for DDoSing Jason's house.
So yeah, first of all, we have a lot of fans,
way more than we thought, which is totally awesome.
I'm going to start seeing if I can collect some metrics
to find out exactly how many fans we have.
We will find you.
Just kidding, just kidding.
And their houses.
No, I'm just kidding.
No, but we have tons of fans.
We love you guys.
It's awesome.
Way more fans than we thought.
And, yeah, you guys totally DDoSed my house
to the point where I couldn't even check my own email.
Oh, sad.
So we're back on reliable hosting though so this episode uh you should be
able to download it at full bandwidth yeah so apologize for any inconveniences anybody had
with that but we are back on track totally all right until next time see you guys later
the intro music is axo by biner pilot programming throwdown is distributed under a creative commons Pilot.