If you can read this, either the style sheet didn't load or you have an older browser that doesn't support style sheets. Try clearing your browser cache and refreshing the page.

(Slate)   Coming to a bookstore near you: 10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10,   (slate.com) divider line 62
    More: Cool, Lawrence Lessig, Dance Dance Revolution, bookstores, Roland Barthes  
•       •       •

5530 clicks; posted to Geek » on 01 Dec 2012 at 3:43 PM (1 year ago)   |  Favorite    |   share:  Share on Twitter share via Email Share on Facebook   more»



62 Comments   (+0 »)
   
View Voting Results: Smartest and Funniest

Archived thread

First | « | 1 | 2 | » | Last | Show all
 
2012-12-01 12:21:12 PM
It's a neat little program. I downloaded a C64 emulator to try it out, and it works exactly as advertised.
 
2012-12-01 12:26:13 PM
That book looks like utter wankery.

Also, the review mentions D&D, but the book would really fail if it did not include a discussion of NetHack.

Of course, it appears that MIT was somehow involved, at least as the publisher, so it probably mentions NetHack.
 
2012-12-01 02:18:00 PM
What's a "bookstore"?
 
2012-12-01 02:51:19 PM
Very interesting stuff.
 
2012-12-01 02:52:08 PM

coco ebert: What's a "bookstore"?


I think they are like those places attached to Starbucks that sell kindles and calanders.
 
2012-12-01 03:52:03 PM
I remember the first time I tried this on my then-new C64.  It was like magic.
 
We were easily impressed in those days.
 
/ adjust belt onion
// hey you kids, don't even THINK about stepping on my lawn
 
2012-12-01 03:56:16 PM
Wait until they discover the power and the glory of Munching Squares.

about 4 or 5 (iirc) assembler instructions on a PDP-1
See it here
 
2012-12-01 04:00:12 PM
It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.
 
2012-12-01 04:03:45 PM

Sliding Carp: Wait until they discover the power and the glory of Munching Squares.

about 4 or 5 (iirc) assembler instructions on a PDP-1
See it here


The topic reminds me of the small demo competitions, where the demo had to fit into a 4K block on disk.
 
2012-12-01 04:04:27 PM
Instead of GOTO 10, just use RUN.

Winterlight: I remember the first time I tried this on my then-new C64.  It was like magic.
 
We were easily impressed in those days.
 
/ adjust belt onion
// hey you kids, don't even THINK about stepping on my lawn


I still remember typing in the sprite example and animating that little C= hot air balloon.
 
2012-12-01 04:07:56 PM
if "10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10,".is_a? Kindle
  MyKindle << "10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10,"
end
 
2012-12-01 04:23:29 PM

beer4breakfast: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.


Kinda sorta but it will compile even if you screw up making a valid 'loop' in the source. This really tripped me up once when I was 12.

/You change just one line number...
 
2012-12-01 04:29:06 PM

beer4breakfast: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.


Oh, a Bordeaux is a loop but these coders wouldn't know that
 
2012-12-01 04:45:56 PM

Dafodude: beer4breakfast: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.

Kinda sorta but it will compile even if you screw up making a valid 'loop' in the source. This really tripped me up once when I was 12.

/You change just one line number...


C-64 BASIC was interpreted, not compiled, and did not have a loop command.
 
2012-12-01 04:55:21 PM

talkertopc: Dafodude: beer4breakfast: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.

Kinda sorta but it will compile even if you screw up making a valid 'loop' in the source. This really tripped me up once when I was 12.

/You change just one line number...

C-64 BASIC was interpreted, not compiled, and did not have a loop command.


No, it didn't, but it did have a ON GOTO command.
 
2012-12-01 04:58:18 PM
I just got a huge nostalgia boner. For BASIC, that is, not the C64. Or the bookstore.
 
2012-12-01 05:02:24 PM
Ahh, basic. So many days of programming delayed loops like that with increasingly terrifying fake error messages as echos.
 
2012-12-01 05:30:07 PM
I loved basic. I remember doing a program on the time share mainframe in college that mimicked a terminal crash, asking the users to put in their User IDs and passwords. It then saved them. Collected 215 IDs and passwords, then went to SysOp to show him the hole in their security. Bastards almost got me expelled.
 
2012-12-01 05:40:29 PM
IMO, this is two lines of code delimited with a colon rather than a newline. No matter how you argue, it is two separate statements.
 
2012-12-01 05:44:57 PM

Quantum Apostrophe: I still remember typing in the sprite example and animating that little C= hot air balloon.


I did that, too.  Ah, good times.  
 

talkertopc: C-64 BASIC was interpreted, not compiled, and did not have a loop command.


Which really screwed with the kids with the TI and early IBM machines. 
 
There was a time when there were as many variations of DOS as there are flavors of Linux today. 
 
/ and then Gates out his foot down and the rest were history
 
2012-12-01 05:55:05 PM
I instinctively kept pressing CTRL+C while watching that video.
 
2012-12-01 05:59:39 PM
babtras: IMO, this is two lines of code delimited with a colon rather than a newline. No matter how you argue, it is two separate statements.

Technically, in a programming language that uses control characters, you can write a huge program on a single line.

// actually, those javascript compression tools use this fact to remove lots of whitespace characters and the like from code (to make the downloads faster).

EX

FOO + BAR becomes FOO+BAR because the space is only necessary for our human brains, the language doesn't care.

// no you can't have huge one line programs python, not yours
 
2012-12-01 06:26:03 PM
Come on, APL enthusiasts. Bring out your favourite bogglers.

Nothing beats APL (aka "Nutters' Basic") for incredibly concise, utterly opaque, one-liners.
 
2012-12-01 06:26:18 PM

Quantum Apostrophe: talkertopc: Dafodude: beer4breakfast: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.

Kinda sorta but it will compile even if you screw up making a valid 'loop' in the source. This really tripped me up once when I was 12.

/You change just one line number...

C-64 BASIC was interpreted, not compiled, and did not have a loop command.

No, it didn't, but it did have a ON GOTO command.


There was a loop command in c-64 basic, FOR...NEXT.

Also, spaghetti GOTO in the book title is bad programming because it in unconditional. If there was a part of the 'loop' that was allocating memory, it would eventually crash the computer. As it is, the program can't be stopped without pressing RUN STOP, and that is supposed to be for emergencies, not part of a good design.

/2 cents
 
2012-12-01 06:32:40 PM
Very cool, subby
 
2012-12-01 06:49:25 PM
If you don't think this is cool, turn in your nerd card.
 
2012-12-01 06:51:34 PM

Vance Uppercut: There was a loop command in c-64 basic, FOR...NEXT.


Granted, but it eventually had to stop. You could code an ON ... GOTO statement to behave pretty much like a DO ... WHILE type affair. I had great fun with the DEF FN command as well.
 
2012-12-01 08:06:27 PM

beer4breakfast: Sliding Carp: Wait until they discover the power and the glory of Munching Squares.

about 4 or 5 (iirc) assembler instructions on a PDP-1
See it here

The topic reminds me of the small demo competitions, where the demo had to fit into a 4K block on disk.


Had? They're still around today. (pops)
 
2012-12-01 09:40:22 PM

Quantum Apostrophe: Instead of GOTO 10, just use RUN.

Winterlight: I remember the first time I tried this on my then-new C64.  It was like magic.
 
We were easily impressed in those days.
 
/ adjust belt onion
// hey you kids, don't even THINK about stepping on my lawn

I still remember typing in the sprite example and animating that little C= hot air balloon.


only problem with using run is that will reset the RND seed... it may go a bit wonky.
 
2012-12-01 09:41:59 PM

talkertopc: Dafodude: beer4breakfast: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.

Kinda sorta but it will compile even if you screw up making a valid 'loop' in the source. This really tripped me up once when I was 12.

/You change just one line number...

C-64 BASIC was interpreted, not compiled, and did not have a loop command.


well... you are right about no loop command, but there were quite a few compilers for basic on the c64... blitz, austrospeed, etc...
 
2012-12-01 09:44:17 PM

Sgt Oddball: I just got a huge nostalgia boner. For BASIC, that is, not the C64. Or the bookstore.


I just bought this recently.
It is BASIC, and C++ interface for the API and soon a Studio component that lets you do all your mesh/level design and export with animations/lighting to it's own format for making into whatever.
 
2012-12-01 09:47:02 PM

Just Another OC Homeless Guy: I loved basic. I remember doing a program on the time share mainframe in college that mimicked a terminal crash, asking the users to put in their User IDs and passwords. It then saved them. Collected 215 IDs and passwords, then went to SysOp to show him the hole in their security. Bastards almost got me expelled.


probably the most complex program i coded in basic on the c64 was a database for karaoke tunes... a dj wanted a way to keep track of his library, so i coded it so that he could input an unlimited number of tracks, including all information about the track and took advantage of the commodore's REL filetype to store the data encoded to take up less space... the only thing i didn't code myself was an ml routine to do the bubble sort in ram of the tracks.
 
2012-12-01 11:01:57 PM
IBM's REXX language had the best loop command construct. DO FOREVER

I wrote hundreds of programs using REXX back in the mid '80's. I can assume they're all still running.
 
2012-12-01 11:06:08 PM
HELLO WORLD.
 
2012-12-01 11:27:52 PM
Eddie Adams from Torrance: IBM's REXX language had the best loop command construct. DO FOREVER

Perl equivalent

while (1) {do something here}

But better written as

my $variable
while ($variable) {do something here}

to give you a loop that runs forever, until you change $variable to a false value. IE, an infinite loop that you can break out of.
 
2012-12-01 11:34:45 PM

Eddie Adams from Torrance: IBM's REXX language had the best loop command construct. DO FOREVER

I wrote hundreds of programs using REXX back in the mid '80's. I can assume they're all still running.


I admit, that rocks. In lieu of that, I offer my all-time favorite from VAX FORTRAN 77:

DO WHILE .TRUE.


/unpredictable results may occur
 
2012-12-02 12:50:21 AM

Quantum Apostrophe: Granted, but it eventually had to stop.


10 FOR Q = 1 TO 2 STEP 0: PRINT CHR$ (205.5 + RND (1)); : NEXT

Colloquially known as "for q very much".
 
2012-12-02 01:27:20 AM
Not very practical is it? I mean, who needs a street map of downtown Shanghai?
 
2012-12-02 03:07:59 AM
Yay programming thread!
I've been wanting to learn a language for a while now but I don't know what one to start with. I took a Visual Basic (shut up) course back in middle school like twelve years ago but I don't remember much at all. So what should I start with? I have a vague idea of making a game but frankly I'd just like to learn.
 
2012-12-02 04:22:52 AM

Sid_6.7: That book looks like utter wankery.


Agreed.
 
2012-12-02 05:39:57 AM
Maybe the book is a lot better than that one excerpt would suggest but....I really don't see the point.
 
2012-12-02 06:09:41 AM

Just Another OC Homeless Guy: I loved basic. I remember doing a program on the time share mainframe in college that mimicked a terminal crash, asking the users to put in their User IDs and passwords. It then saved them. Collected 215 IDs and passwords, then went to SysOp to show him the hole in their security. Bastards almost got me expelled.


Me: Alright, check it out - here's the program I wrote for class. Awesome right!
Friend: How'd you open your class stuff from the library? You didn't bring a disk?
Me: The network guys set it up so that we're admins of our own folders. All you need to do is grant everyone in the district read permissions and you can access your class stuff anywhere. Then I made a subfolder called 'Incoming' that anyone can write to. Now I can do extra class work during my lunch period because I'm a nerd who likes that crap.
Friend: Huh - cool.

3 Months later

Principal: YOU ARE A DIRTY EVIL HACKER! YOU CHANGED THE RESOLUTION SO YOU COULD SEE PARTS OF THE SCREEN THAT STUDENTS WEREN'T SUPPOSED TO SEE! YOU HACKED THE NETWORK AND GAVE EVERYONE COPIES OF YOUR PROGRAMS! YOU CAN NOT GO BACK TO CLASS
Me: Seriously?

They failed me from the class, had me spend the rest of the year in 'study hall', and threatened to expel me. Because I wanted to work on my stupid high school's VB class assignment during my lunch. Public schools are trash. The functionally retarded principal was earning well over six figures (and this was quite some time ago). She's probably some superintendent now. I ended up getting two degrees in Computer Science and a moderately successful career as a Software Engineer. Thank God they took action to prevent my evilness.
 
2012-12-02 08:31:11 AM

beer4breakfast: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.


They are not saying it isnt a loop. I've bolded the key word you should pay attention to.
 
2012-12-02 08:35:06 AM

talkertopc: Dafodude: beer4breakfast: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.

Kinda sorta but it will compile even if you screw up making a valid 'loop' in the source. This really tripped me up once when I was 12.

/You change just one line number...

C-64 BASIC was interpreted, not compiled, and did not have a loop command.


It has several loops. For:next and Gosub:Return were both better choices then Goto. Depending on your needed application. Goto was for sloppy coding
 
2012-12-02 08:37:19 AM

babtras: IMO, this is two lines of code delimited with a colon rather than a newline. No matter how you argue, it is two separate statements.


it is one line of code, as it is written on 1 line. Doesnt matter if it is two separate statements. See Lisp for examples of Multiple statements appearing on 1 line
 
2012-12-02 08:43:12 AM

Quantum Apostrophe: Vance Uppercut: There was a loop command in c-64 basic, FOR...NEXT.

Granted, but it eventually had to stop. You could code an ON ... GOTO statement to behave pretty much like a DO ... WHILE type affair. I had great fun with the DEF FN command as well.


No it didnt ever have to stop. it could be used as a Do..loop
ex:


10 For I=0 to 1
20 Print "Blah"
30 Input "Type something and hit enter"; A$
40 IF A$"END" then I=-1
50 Next I


My Syntax may be a bit off, been a long time since c64 basic, but i'm sure you catch the Gist of the thing.
 
2012-12-02 09:52:46 AM

steveGswine: Quantum Apostrophe: Granted, but it eventually had to stop.

10 FOR Q = 1 TO 2 STEP 0: PRINT CHR$ (205.5 + RND (1)); : NEXT

Colloquially known as "for q very much".


Really? Gotta try that!
 
2012-12-02 10:24:14 AM

SwingDancer: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.

They are not saying it isnt a loop. I've bolded the key word you should pay attention to


Then, specifically, what "more elegant loop" construct for doing the equivalent in C64 BASIC is the author referring to?
 
2012-12-02 01:13:46 PM

beer4breakfast: SwingDancer: It uses a GOTO instead of a more elegant loop.

Using a goto to jump back to a label is a loop.

They are not saying it isnt a loop. I've bolded the key word you should pay attention to

Then, specifically, what "more elegant loop" construct for doing the equivalent in C64 BASIC is the author referring to?


I gave several examples already


Gosub..Return
For...Next

If you wanted the same endless loop as they used, for...next with a step of 0 will achieve that, although endless loops in and of themselves without any way to exit are inelegant. A better choice would be to use the for..next with a step of 0, with a condition such as pressing a key(peek 197) as an exit,

Here is a quote from http://technikhil.wordpress.com/2010/02/24/how-to-write-beautiful-cod/
If you've never read it, its a GREAT read, but runs for a bit.

~Partial Quote~
Beautiful code is elegant and simple - it is concise but clear. There is a balance in the code - a rhythm in the definition and structure of conditionals and the loops. The intent of the each function shines through the code - a pattern in the creation and interaction of the classes and methods in classes that combines the code into a coherent and beautiful unit. Beautiful code is concise, there are no wasted variables or endless conditionals - it is a pleasure to read not just because of the ease of reading but from the way in which it communicates the ideas and intent of the
programmer.
~end quote

goto doesn't achieve this as it jumps all over the place. No clearly defined entry and exit. code often falls through logical sections or has more then one exit point leading to confusion.
 
2012-12-02 01:42:26 PM

SwingDancer: ~Partial Quote~
Beautiful code is elegant and simple - it is concise but clear. There is a balance in the code - a rhythm in the definition and structure of conditionals and the loops. The intent of the each function shines through the code - a pattern in the creation and interaction of the classes and methods in classes that combines the code into a coherent and beautiful unit. Beautiful code is concise, there are no wasted variables or endless conditionals - it is a pleasure to read not just because of the ease of reading but from the way in which it communicates the ideas and intent of the
programmer.
~end quote


Sounds like in this particular case using a goto is the most elegant solution for what's suppose to be the smallest amount of code to get the desired result. That being the case, the author of the article was implying the solution wasn't a loop at all.
 
Displayed 50 of 62 comments

First | « | 1 | 2 | » | Last | Show all

View Voting Results: Smartest and Funniest


This thread is archived, and closed to new comments.

Continue Farking
Submit a Link »






Report