mersenneforum.org Kids?
 Register FAQ Search Today's Posts Mark Forums Read

 2012-07-25, 23:36 #1 Xyzzy     Aug 2002 845110 Posts Kids? We are looking for something similar to Project Euler, except geared towards kids in the 6th to 8th grade range. A list of problems to solve would be fine but an infrastructure to test and keep track of results would be ideal. We would like the problems to get progressively harder and possibly force the young programmer to step outside their comfort zone a little each time. Problems that take just a simple answer, like the ones at Project Euler, are great because we do not want to mess with file I/O or stuff like that. (We will be using Scratch.) Ideas?
 2012-08-03, 08:02 #2 Xyzzy     Aug 2002 33·313 Posts Nobody? We designed and assigned problem one, which is to accept input from the keyboard and, if the input is an integer equal to or between 1 and 1,000, output whether the input is prime or composite. We think the parameters of this challenge are properly stated, but if you all see something wrong please let us know! The "class" went well, we think. The test subject, age 11, showed us their final program, running, and we tried to break it. We are not, yet, at the point to critique code practices, although we did have the test subject print out the "code", annotate it and tape it to the wall. When asked why, we indicated that code reuse is "being lazy in a good way" and that very quickly (Less than a few hours for us!) most code is forgotten if not documented. At each of the following points the test subject needed to go fix things: Input not checked to make sure it was less than or equal to 1,000. Input not checked to make sure it was greater than or equal to 1. Input not checked to make sure it was an integer. Output for "1" was not listed as "not prime or composite". (This one took a long time to figure out. We allowed the test subject to use Internet resources to figure it out.) Overall we all had a lot of fun. The algorithm the test subject used was pure brute force but it worked. We have made problem two a challenge to make the program from problem one at least twice as fast. We subtly hinted to the test subject that it might be possible to increment through the loop with a different sized step and that there was no need to test all numbers below the input as possible factors. (We are trying to keep it simple enough to solve without ruining the experience.) Anyways, the test subject earns $5 (!) for every correct program so we need a few more problems, so we can try to understand and solve them first, since the test subject is very motivated to earn money. Thanks! PS - The IDE for Scratch is very cool! Debugging is a lot of fun because it allows you to step through the program graphically. Attached Thumbnails  2012-08-03, 08:29 #3 Dubslow Basketry That Evening! "Bunslow the Bold" Jun 2011 40 1 and n <= 1000: # In Python, "if 1 < n <= 1000" is actually a valid conditional stuff() elif n==1: print("Neither") ...as opposed to... Code: if n >= 1: if n==1: print("Neither") elif n <= 1000: stuff() Edit: About coding practices, everything falls under something like: Be clear -- fancy tricks aren't great if they aren't necessary, because they're often confusing Be maintainable -- as you point out, you or anyone else should be able to come back to it and understand it from a cold start -- good docs help, but clear code helps more You should be able to pass off the project to somebody else and have them dive right in after 1, maybe 2 read throughs. Everything else like proper syntax, proper indentation, etc., falls under these not-really-different points. (Of course, there are exceptions to these rules, e.g. library code which isn't read except by a few people, and speed critical code like Prime95's asm, but nothing that your subject will write in the near future will fall under these categories.) Last fiddled with by Dubslow on 2012-08-03 at 08:33 2012-08-03, 08:54 #4 Xyzzy Aug 2002 33·313 Posts Quote:  You say "check for int", but that pic you showed does no such thing, unless Scratch can determine on the fly if a string represents an int or not. Quote:  Also, what the heck is with the if n%1==0? That's trivially true for any natural number. That is how our test subject checked to make sure it was an integer. 1.5 mod 1 is 0.5, thus it is not an integer. 4 mod 1 is 0, thus it is an integer. (This is sane, right? It works in the program!) We are still digesting our test subject's thought process. We tried Python but our test subject lost interest very quickly. We were using this book/PDF. The test subject reacted violently to lines in the interpreter that went like this: Code: $ python
Python 2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3] on linux2
>>> 3/2
1
>>> 3.0/2
1.5
We will read and reply to your other thoughts tomorrow today since it is almost 4AM and we probably should get some sleep.

 2012-08-03, 09:09 #5 Dubslow Basketry That Evening!     "Bunslow the Bold" Jun 2011 40>> 3/2 1.5 >>> 3//2 1 As for the int thing, what's this? Code: "this is a string" % 2 That causes a TypeError in Python. What happens when you type 'this is not a number' into that Scratch program? Last fiddled with by Dubslow on 2012-08-03 at 09:11
2012-08-03, 15:24   #6
Xyzzy

Aug 2002

204038 Posts

Quote:
 What happens when you type 'this is not a number' into that Scratch program?
Do you mean typing in garbage (text and/or symbols) at the input?

Input like that is handled by the first conditional statement.

Scratch also allows very large numbers to be used without any special type declarations.

It is designed to be for kids, so they (We think!) are focusing more on getting kids programming than spending hours worrying about syntax. Most of the programming is point-and-click. Our test subject spent several hours reading the first chapter of the previously linked Python book before attempting to program. With Scratch we started the IDE and the test subject was programming within a minute. Sure, the first program was a loop that made an annoying cat sound repeatedly, but it was a program that was done without any intervention on our part.

While we prefer a more structured (?) language, and we go to the extreme of flowcharting on paper first, we would much rather have our test subject program in Scratch than not at all. And, we think that solving problem one with no programming experience is a pretty good start. Of course, we guided the test subject a lot, but only by answering questions. We did not sit at the computer at all.

Scratch is certainly not fast nor optimized but if it ignites a fire for solving big problems by making them into a bunch of little problems, we will be pleased.

So we are still looking for program ideas, or maybe an appropriate textbook.

FWIW, this programming forum has many examples of our poor programming skills if you have the time to search for them. They are embarrassing but we have a lot of fun messing around.

2012-08-03, 15:40   #7
xilman
Bamboozled!

"𒉺𒌌𒇷𒆷𒀭"
May 2003
Down not across

260348 Posts

Quote:
 Originally Posted by Xyzzy So we are still looking for program ideas, or maybe an appropriate textbook.
Classics include swapping two variables (lots of undergraduates have problems with that one); rather more difficult: sorting into numerical order; even more difficult: towers of Hanoi.

Paul

2012-08-03, 15:46   #8
Dubslow

"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

11100001101012 Posts

Quote:
 Originally Posted by xilman Classics include swapping two variables (lots of undergraduates have problems with that one); rather more difficult: sorting into numerical order; even more difficult: towers of Hanoi. Paul
Ooohh, recursion... probably best saved for quite a bit further into the future

(PS Re swapping, Python lets you do this: x, y = y, x )

 2012-08-03, 15:56 #9 Xyzzy     Aug 2002 204038 Posts We have assigned problem three, which is to sum the first 100 prime numbers. @ xilman - The next problem will involve swapping variables. We just need to figure out a way to make it interesting. Thanks for the idea! We want to do some sorting exercises but first we need to look at if/how Scratch handles arrays. We do know that it is possible to address individual characters in a string, so that would work for a simple problem. We are holding off on things like "Towers of Hanoi" or "Eight Queens" for a while.
 2012-08-03, 16:43 #10 Dubslow Basketry That Evening!     "Bunslow the Bold" Jun 2011 40
2012-08-03, 16:49   #11
science_man_88

"Forget I exist"
Jul 2009
Dumbassville

838410 Posts

Quote:
 Originally Posted by Xyzzy We have assigned problem three, which is to sum the first 100 prime numbers. @ xilman - The next problem will involve swapping variables. We just need to figure out a way to make it interesting. Thanks for the idea! We want to do some sorting exercises but first we need to look at if/how Scratch handles arrays. We do know that it is possible to address individual characters in a string, so that would work for a simple problem. We are holding off on things like "Towers of Hanoi" or "Eight Queens" for a while.
variables -> make a list might work for an array. and it can as long as you can get the string into an array as characters in each index.

Last fiddled with by science_man_88 on 2012-08-03 at 17:39 Reason: changed he to the

 Similar Threads Thread Thread Starter Forum Replies Last Post science_man_88 science_man_88 0 2017-11-17 21:37 TheMawn Lounge 1 2013-11-17 08:53 firejuggler Lounge 15 2011-03-23 05:17

All times are UTC. The time now is 12:53.

Wed May 18 12:53:37 UTC 2022 up 34 days, 10:54, 0 users, load averages: 1.46, 1.88, 1.78