Open coding session #1

Tuesday February 17, 2015. Both Lovelace and Hopper sections are welcome.

Try coding one of these projects, or do something from your own imagination. You are also welcome to revisit some of your projects from earlier units and work on them or the bonuses.

We encourage you to work with a partner if possible.

  • Implement one or more of these PencilCode projects in Scratch or JavaScript (press the Play button (the triangle) to see the program in action. When you take a program written in one language and re-implement it in another language it is called porting the code. It's OK to look at the code if you'd like, or you could just look at the behavior of the program and use your ingenuity to write the code fresh from that. It's also OK to make your new program behavior differ a bit from the original, or improve the project as you like.
      • Draw a ticking second hand. (code)
        • Bonus activity: make the hand tick without leaving a trail of grey lines behind it.
        • Bonus activity 2: make a clock with hour, minute and second hand.
        • Bonus activity 3: make the clock show the current time!
      • Guess my number. (code) The computer thinks of a number in a stated range. The user tries to guess it. After each guess is entered, the computer announces if the secret number is higher or lower than the guess. When the correct number is entered, the user wins. Bonus activity: award the user points based on the number of guesses it took to get the correct number.
      • Turtle race. (code) Seven turtles race towards a finish line, moving fast and slow at random. The PencilCode implementation uses the "hatch" instruction, which is similar to cloning in Scratch. We haven't learned about cloning yet, but you can read the Scratch documentation and give it a try if you like. It's also possible to build this project without cloning.
    • Write a program that draws your name using a pen. Don't make or use individual letter sprites, use some pen drawing blocks/functions to make the letters themselves.
    • The book BASIC Computer Games (edited by David H. Ahl, published 1978) was one of the landmark texts of the home computing revolution in the late 70's and early 80's. It contains 101 simple games together with code you could type into the computer. Choose one of the games and implement the project in Scratch or JavaScript (you're welcome to look at the code there, but treat it more as archeology than anything else). Here's some examples you might choose.
    • Acey Ducey. This is a simulation of the Acey Ducey card game. In the game the dealer (the computer) deals two cards face up. You have an option to bet or not to bet depending on whether or not you feel the next card dealt will have a value between the first two.
    • Amazing. Write a program that creates a maze with a start, an end, and only one path between them.
    • Mancala. Write a program that allows a human to play Mancala against a human (this game is also called Awari. If you don't know the game, look up the rules on the Web). Add a graphical user interface.
    • Lemonade Stand was one of my favorite games as a 10-year-old. It's an economic simulation, where you are running a lemonade stand and have to decide how many pitchers of lemonade to make for the day, and how much to charge for a cup. There's some randomness involved in what the whether turns out to be, how many customers show up. The more expensive you make your lemonade, the fewer people buy it. You can make the cost for lemons and sugar to be always the same, or to go up and down each day.
    • The player makes business choices each day and tries to earn as much money as possible at by the end of the week. You can see some examples of Scratch projects implementing this game here, here, and here. Try implementing some version of this game in Scratch or JavaScript.