[racket-users] My son's game in Racket

2015-08-24 Thread John Carmack
We released my 10 year old son's game that was done in Racket: 
www.1k3c.comhttp://www.1k3c.com

I'm still taking a little heat from my wife for using an obscure language 
instead of something mainstream that is broadly used in industry, but I have 
nothing but good things to say about using Racket and DrRacket for a beginning 
programmer, and highly recommend it.

I can't recommend 2htdp/universe for this sort of thing, though.  I had to drop 
to the native GUI bitmaps for performance reasons, hack around the lifecycle to 
support a separate editor window, and I still don't know how to make the Quit 
menu item actually exit the app on the Mac version.

I completely understand the reasoning for the way 2htdp/universe is built, and 
saying that a real project should use the grown-up APIs is fine, but the 
evolution from making a little animation to controlling it somehow to fleshing 
it out into a game is so natural that recommending a fairly big rewrite is 
unfortunate.

I'm a big booster of functional programming, but I'm not sure that the 
functional drawing paradigm ever really sank in while my son was working with 
it, rather it felt like you just drew everything backwards with missing 
parenthesis at the end.  I suspect that using the standard imperative GUI 
drawing code will make perfect sense to him.

I'm not sure yet if we are going to migrate to the regular GUI code for 
upcoming work, or jump all the way to OpenGL so he can learn the joys of Why 
is the screen all black?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: [racket-users] My son's game in Racket

2015-08-24 Thread John Carmack
The performance problems were related to the larger scrolling worlds.  The H2DP 
versions got slower the more clouds were in the maps.  As an aside, what drove 
the 20-something fps tic rate for H2DP, versus 30 for an every-other-vsync 
update?

He is already through Algebra 2, so he gets functions.  He didn't have any 
difficulty applying the functional image model, but when you have 20 lines of 
text drawing composed together, it really looks like you are just drawing 
things one after another, but backwards.  The cases where it has value, like 
building a character up out of multiple things, then placing it somewhere in 
the world, tend to be the minority of operations compared to just drawing 
independent elements on the screen.

My wife managed programmers for years, and she has opinions about pragmatic 
developers, which usually involve Java or C++.  I tend to think that worrying 
about our 10 year old's future career prospects is a bit premature, and want to 
focus on developing abstract programming skills. :-)

Unity/C# can be incredibly rewarding, but the entire ecosystem almost drives 
you away from programming as a beginner -- find the right script on the asset 
store and figure out how to configure it in the editor, rather than reinventing 
the wheel and writing it yourself.

One of the non-obvious things that I think is beneficial with DrRacket is that 
it has an approachable complexity level.  Dropping a newbie into Eclipse or 
MonoDevelop makes them feel like they are walking around in a byzantine museum, 
afraid to touch things, while DrRacket feels closer to old-school personal 
computers where you felt like you were in command of the machine.



-Original Message-
From: Matthias Felleisen [mailto:matth...@ccs.neu.edu] 
Sent: Monday, August 24, 2015 12:18 PM
To: John Carmack
Cc: Racket Users
Subject: Re: [racket-users] My son's game in Racket

Thanks for sharing. You can let Ryan know that he has his first grandma user, 
and in that mode, I managed to get a few extra lives. 

A couple of comments: 

-- In the past, some teachers have shared similar 'world/universe' games with 
me with similar performance. 
-- If your son is in middle school, he should see pre-algebra soon, and you 
may wish to revisit the initial drafts of the game then. 
 You can show directly how pre-algebra applies and how the game is 
basically written in pre-algebra. 
-- Learning FP and the connection to math may work better if you actually use 
the design recipe from HtDP [2e]. 
 I know of a child who worked through this book between the ages of 8 and 
12 and had a grand time with math and programming then. 
-- And finally, I am curious about your wife's comment. 
 What's so objectionable to learning fundamentals first and commercial 
things when you need to go professional? 
 Your son used C#/Unity last year. Was it much easier? 

I have acknowledged the lack of a growth path from 'world' to a performant 
model in the past, and I will continue to admit the problem. 

-- Matthias




-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] My son's game in Racket

2015-08-24 Thread Matthias Felleisen

On Aug 24, 2015, at 12:27 PM, John Carmack jo...@oculus.com wrote:

 We “released” my 10 year old son’s game that was done in Racket: www.1k3c.com
  
 I’m still taking a little heat from my wife for using an obscure language 
 instead of something mainstream that is broadly used in industry, but I have 
 nothing but good things to say about using Racket and DrRacket for a 
 beginning programmer, and highly recommend it.
  
 I can’t recommend 2htdp/universe for this sort of thing, though.  I had to 
 drop to the native GUI bitmaps for performance reasons, hack around the 
 lifecycle to support a separate editor window, and I still don’t know how to 
 make the Quit menu item actually exit the app on the Mac version.
  
 I completely understand the reasoning for the way 2htdp/universe is built, 
 and saying that a “real” project should use the grown-up APIs is fine, but 
 the evolution from making a little animation to controlling it somehow to 
 fleshing it out into a game is so natural that recommending a fairly big 
 rewrite is unfortunate.
  
 I’m a big booster of functional programming, but I’m not sure that the 
 functional drawing paradigm ever really sank in while my son was working with 
 it, rather it felt like you just drew everything backwards with missing 
 parenthesis at the end.  I suspect that using the standard imperative GUI 
 drawing code will make perfect sense to him.
  
 I’m not sure yet if we are going to migrate to the regular GUI code for 
 upcoming work, or jump all the way to OpenGL so he can learn the joys of “Why 
 is the screen all black?”
  


Thanks for sharing. You can let Ryan know that he has his first grandma user, 
and in that mode, I managed to get a few extra lives. 

A couple of comments: 

-- In the past, some teachers have shared similar 'world/universe' games with 
me with similar performance. 
-- If your son is in middle school, he should see pre-algebra soon, and you 
may wish to revisit the initial drafts of the game then. 
 You can show directly how pre-algebra applies and how the game is 
basically written in pre-algebra. 
-- Learning FP and the connection to math may work better if you actually use 
the design recipe from HtDP [2e]. 
 I know of a child who worked through this book between the ages of 8 and 
12 and had a grand time with math and programming then. 
-- And finally, I am curious about your wife's comment. 
 What's so objectionable to learning fundamentals first and commercial 
things when you need to go professional? 
 Your son used C#/Unity last year. Was it much easier? 

I have acknowledged the lack of a growth path from 'world' to a performant 
model in the past, and I will continue to admit the problem. 

-- Matthias




-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] My son's game in Racket

2015-08-24 Thread Jens Axel Søgaard
2015-08-24 18:27 GMT+02:00 John Carmack jo...@oculus.com:

 We “released” my 10 year old son’s game that was done in Racket:
 www.1k3c.com


Tell him, he has done a great job.

It has the right game feel. I liked both how the levels progressed slowly
in difficulty
and that there were so many of them.

/Jens Axel

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] My son's game in Racket

2015-08-24 Thread Joel McCracken
FYI, I think the Mac version is out of date. Dropbox says the mac
installer file is two weeks old, and the windows version is a few
hours old.



On Mon, Aug 24, 2015 at 12:27 PM, John Carmack jo...@oculus.com wrote:
 We “released” my 10 year old son’s game that was done in Racket:
 www.1k3c.com



 I’m still taking a little heat from my wife for using an obscure language
 instead of something mainstream that is broadly used in industry, but I have
 nothing but good things to say about using Racket and DrRacket for a
 beginning programmer, and highly recommend it.



 I can’t recommend 2htdp/universe for this sort of thing, though.  I had to
 drop to the native GUI bitmaps for performance reasons, hack around the
 lifecycle to support a separate editor window, and I still don’t know how to
 make the Quit menu item actually exit the app on the Mac version.



 I completely understand the reasoning for the way 2htdp/universe is built,
 and saying that a “real” project should use the grown-up APIs is fine, but
 the evolution from making a little animation to controlling it somehow to
 fleshing it out into a game is so natural that recommending a fairly big
 rewrite is unfortunate.



 I’m a big booster of functional programming, but I’m not sure that the
 functional drawing paradigm ever really sank in while my son was working
 with it, rather it felt like you just drew everything backwards with missing
 parenthesis at the end.  I suspect that using the standard imperative GUI
 drawing code will make perfect sense to him.



 I’m not sure yet if we are going to migrate to the regular GUI code for
 upcoming work, or jump all the way to OpenGL so he can learn the joys of
 “Why is the screen all black?”



 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] My son's game in Racket

2015-08-24 Thread Alexander D. Knauth
Or something like this, with the rackjure package:
(require rackjure/threading 2htdp/image)
(~ background-img
 (place-image image-1 x y) ; the background-img will be inserted as the 
last argument, because that's what ~ does
 (place-image image-2 x y) ; the background + image-1 will be inserted as 
the last argument
 (place-image image-3 x y) ; and so on
 ...)
Or if you don't want to use rackjure, then with let* it would be:
(let* ([img background-img]
   [img (place-image image-1 x y img)]
   [img (place-image image-2 x y img)]
   [img (place-image image-3 x y img)]
   ...)
  img)

On Aug 24, 2015, at 2:40 PM, Joel McCracken mccracken.j...@gmail.com wrote:

 This would be where I would reach for a let* to handle intermediate
 results, because code like this is very awkward.
 
 On Mon, Aug 24, 2015 at 2:32 PM, John Carmack jo...@oculus.com wrote:
 The idea that you functionally compose images like this:
 
 (place-image image-1 x y
(place-image image-2 x y
(place-image image-3 x y)))
 
 Which draws image1 on top of image2 on top of image 3, which is backwards 
 from the painters order that would draw image 3, then image 2, then image 
 1.
 
 This imperative, side-effect-ing code is a little less clear to a beginner 
 with the OOP and DC concepts, but It better represents what actually 
 happens, and it is much easier to modify the code without worrying about the 
 nesting.
 
 (send dc draw-bitmap imag3 x y)
 (send dc draw-bitmap imag2 x y)
 (send dc draw-bitmap imag1 x y)
 
 -Original Message-
 From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] 
 On Behalf Of David Grenier
 Sent: Monday, August 24, 2015 1:14 PM
 To: Racket Users
 Cc: John Carmack
 Subject: [racket-users] Re: My son's game in Racket
 
 On Monday, August 24, 2015 at 12:28:07 PM UTC-4, John Carmack wrote:
 We “released” my 10 year old son’s game that was done in Racket:
 www.1k3c.com
 
 
 
 I’m still taking a little heat from my wife for using an obscure
 language instead of something mainstream that is broadly used in industry, 
 but I have nothing but good things to say about using Racket and DrRacket 
 for a beginning programmer,  and highly recommend it.
 
 
 
 I can’t recommend 2htdp/universe for this sort of thing, though.  I
 had to drop to the native GUI bitmaps for performance reasons, hack around 
 the lifecycle to support a separate editor window, and I still don’t know 
 how to make the Quit  menu item actually exit the app on the Mac version.
 
 
 
 I completely understand the reasoning for the way 2htdp/universe is
 built, and saying that a “real” project should use the grown-up APIs is 
 fine, but the evolution from making a little animation to controlling it 
 somehow to fleshing it  out into a game is so natural that recommending a 
 fairly big rewrite is unfortunate.
 
 
 
 I’m a big booster of functional programming, but I’m not sure that the
 functional drawing paradigm ever really sank in while my son was working 
 with it, rather it felt like you just drew everything backwards with 
 missing parenthesis at  the end.  I suspect that using the standard 
 imperative GUI drawing code will make perfect sense to him.
 
 
 
 I’m not sure yet if we are going to migrate to the regular GUI code for 
 upcoming work, or jump all the way to OpenGL so he can learn the joys of 
 “Why is the screen all black?”
 
 
 
 Not clear what was meant both times you wrote backwards are you referring 
 to the lisp-style function call? Something that could be alleviated by say 
 F#'s pipe forward operator?
 
 let (|) a f = f a
 
 or Clojure's - macro?
 
 --
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit 
 https://urldefense.proofpoint.com/v1/url?u=https://groups.google.com/d/optoutk=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0Ar=Kjg6LltY9QjkipKooaVldA%3D%3D%0Am=HArZE0M9OqU4wspKLzQzG6N5gO9ncSxPP9qVzkUgoVU%3D%0As=b451faca736dc42c554f148983e7279865ef32be9ddf2df75f5c88c15dd34a73.
 
 --
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com

Re: [racket-users] My son's game in Racket

2015-08-24 Thread 'John Clements' via Racket Users

 On Aug 24, 2015, at 11:32 AM, John Carmack jo...@oculus.com wrote:
 
 The idea that you functionally compose images like this:
 
 (place-image image-1 x y 
   (place-image image-2 x y
   (place-image image-3 x y)))
 
 Which draws image1 on top of image2 on top of image 3, which is backwards 
 from the painters order that would draw image 3, then image 2, then image 1.
 
 This imperative, side-effect-ing code is a little less clear to a beginner 
 with the OOP and DC concepts, but It better represents what actually happens, 
 and it is much easier to modify the code without worrying about the nesting.
 
 (send dc draw-bitmap imag3 x y)
 (send dc draw-bitmap imag2 x y)
 (send dc draw-bitmap imag1 x y)

Working with my children and first-year students I see this problem all the 
time; probably at least half of the kids I work with feel this way.

After thinking about it a bit, though, I see that the fundamental problem here 
isn’t functional vs. imperative; it has to do with operator order. So, for 
instance, I claim that my students would be (relatively) happy if they got to 
write

((image3 
  place-image x y image2)
 place-image x y image1)

I don’t have a good answer here—many people have tried to build infix syntax 
for Scheme  Racket, and none of them has yet caught on. Perhaps Alex Knauth’s 
macro is the right thing, but what’s really needed (it seems to me) is a 
solution with widespread acceptance.

John



-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] My son's game in Racket

2015-08-24 Thread Aaron Hamilton
On Monday, August 24, 2015 at 5:43:38 PM UTC, John Carmack wrote:
 He didn't have any difficulty applying the functional image model, but when 
 you have 20 lines of text drawing composed together, it really looks like you 
 are just drawing things one after another, but backwards.

(define (pipe . d) (apply compose (reverse d)))

;-)

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] My son's game in Racket

2015-08-24 Thread Matthias Felleisen

On Aug 24, 2015, at 3:40 PM, François Beausoleil 
francois.beausol...@gmail.com wrote:

 Le lundi 24 août 2015 12:28:07 UTC-4, John Carmack a écrit :
 ...
 
 Hello John,
 
 Thanks for sharing. Played a few levels and had fun :)
 
 I have a 10 year old daughter. Did your son show interest in programming or 
 did you initiate him yourself? I remember I started when I was 10 years old 
 as well. I'd like to introduce my daughter to programming too, and was 
 wondering when the right time would be. I tried Logo last year, but after 5 
 minutes, she didn't see any interest in it.
 
 Have a great day!
 François Beausoleil
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


Francois, since you are on the Racket mailing list, may I recommend the 
Bootstrap material? It is a restricted version of the Universe approach as 
John calls it, tailored to 10-12 year olds who are just finding out about 
expressions and functions (in the US. Does not apply to my experience with 
European schools.) You can play with this in DrRacket off-line or if you prefer 
you can use WeScheme as an on-line tool with this approach. The point is to 
reinforce math (a traditional school topic) with programming and to use this 
kind of programming as a gateway for real programming (in a mostly functional 
style. None of us are purists; we are American pragmatists.) 

See bootstrap-world.org 

-- Matthias

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.