Over the last few days, Sophie had been playing Midnight Mansion, a platform/side scroller game. So here is my (hopefully continuing) diary of coding with my daughter… (Our results, live demo and source code, are at the bottom.) Afterwards, I thought it might be interesting to try to record the process we’re going through - see what happens. So I told Sophie that we’d start making a game tomorrow. I have often wondered how low in age you could take Greenfoot. I have used Greenfoot with kids (mostly about 15 years old), but more often I do presentations and workshops for teachers. Research into programming education, tool design, etc. So far, that has all been part of my research work. I am a computer scientist, and one of our projects is Greenfoot – a programming environment designed to teach kids (and older students) to code with Java. Now, there’s a challenge, if I ever saw one. (Well, only a few weeks away from being ten – at this age, a year still matters.) She has never written any code before. Yesterday, my daughter Sophie asked me to show her how to write a computer game. Some of the Greenfoot code shown can be written more easily in newer versions of Greenfoot, using newer API methods.) (Note: This post is more than 10 years old. Update: Part II, Part III and Part IV of this story are available now. Where the last version gives you an array of strings (arrays of chars) that you actually can edit.First party of a journey of writing a Doctor Who video game in Java with my 9-year-old daughter. If you write: char string = //array of pointers to CONSTANT strings The array is created in a read only part of memory, so you can't edit the value through the pointer, whereas: char string = "Some string" Ĭreates the same, read only, constant string, and copies it to the stack array. No, you're creating an array, but there's a big difference: char *string = "Some CONSTANT string" With the above, you can access the fourth element (the 'b' character) using either arrayĪnd because addition is commutative, the last can also be expressed as *(3 array) ![]() But because arrays decays to pointers it's possible to use some pointer arithmetic with arrays.įor example: char array = "Foobar" /* Declare an array of 7 characters */ Using the array above,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |