CSCI 1004          Home Course Info Homework Students Book

# CSCI 1004 – Homework

### Homework 1

Assigned Mon 1/5, due Wed 1/7. Play with drawing in Pencil Code to get familiar with the environment and the language. Write a program that draws a nice picture. Be sure to employ lines, points, and loops in your program. See the Pencil Code worksheets for measuring angles, drawing a flower, a car, a letter, or a flag for good starting points and examples of how to incrementally develop a program. Name your program hw1 and save it in your account on pencilcode.net.

### Homework 2

Assigned Wed 1/7, due Mon 1/12. Create a picture in Pencil Code of an underwater (or deep space) scene (see, for example, this gallery for inspiration). You are required to define and use functions that take parameters. Start by defining a function called triangle that takes parameters for the position, side length, and fill color. Then define a function called polygon that takes parameters for the position, number of sides, side length, and fill color. A third function should create n bubbles (or stars) at random locations on the screen. Name your program hw2 and save it in your account on pencilcode.net. Your submission will be judged on creativity and effort, style, use of functions and parameters, and whether the code obeys the given specifications. As a reminder, good style dictates that you include your name in a comment at the top (note: first-name only here in Pencil Code), give a comment for each function, define functions at the top of the file, main program at the bottom. Among other definitions of your choosing, be sure to include definitions for
triangle(x, y, len, color)
polygon(x, y, sides, len, color)
bubbles(n) (or stars(n))
main()
Get creative and have fun! Sample starting point. Sample solution.

### Homework 3

Assigned Mon 1/12, due Wed 1/14. Learn about the Turing Test and play with some chatbots. Then write your own! Play with input in Pencil Code and the examples we did in class on Mon 1/12. Make your chatbot as convincing as possible. Submit a log or screen snapshot of a conversation, as well as the complete URL of where your code is (e.g., http://david.pencilcode.net/edit/hw3). Remember to comment your code (including a comment with your first name at the top of the file) and use good style.
Have fun! Sample starting point. Sample solution.

### Homework 4

Assigned Thu 1/15, due Mon 1/19. Create a web page on our CS server basin. Name your file "index.html" and save it in your public_html folder on basin. Any additional files needed (e.g., images) should be saved in this folder as well. Downsize your files with any photo editor before adding them to your web page.
If editing HTML on your own Mac laptop, use TextWrangler; on a PC use Notepad++. On a Mac connect to basin with smb://basin.cs.middlebury.edu; on a PC connect to \\basin.cs.middlebury.edu\username.
We look forward to seeing your pages! Sample starting point (text version).

### Homework 5

Assigned Mon 1/19, due Wed 1/21.
(1) In class we created some "Ascii art". Play with these examples so you understand them and then write code for the unsolved one. Submit a screen snapshot as well as the complete URL of where your code is (e.g., http://cs1004.pencilcode.net/edit/ascii).
```    *
**
***
****
*****
```

(2) Let's write a game! Work through the "Frog" README file and get a working version of the frog game. Then make it your own -- use different images, use your imagination! You can find your own images and store them in your public_html folder on basin, then reference them from your code with a full URL (e.g., <img src="http://www.cs.middlebury.edu/~myname/images/bike.png">). Submit a screen snapshot as well as the complete URL of where your code is (e.g., http://david.pencilcode.net/edit/hw5). Remember to comment your code (including a comment with your first name at the top of the file) and use good style.
Have fun! Sample starting point.

### Homework 6

Assigned Wed 1/21, due Mon 1/26.
Write an adventure game! See the Pencil Code Imagine tab and Incremental game development page for examples of incremental development. Sample starting point.

### Final Project

Assigned Wed 1/21, with deadlines Thu 1/22, Mon 1/26, Thu 1/29.
Write a game! This final project will be done in pairs. Ideas include Tic-Tac-Toe, Connect 4, Lights-Out (aka "Quinto"), Pong, Minesweeper, Checkers, Tetris, Nim, Brick Breaker, Flappy Bird, a card game (such as War or Blackjack), Maze following, etc. See also the examples at Think.com. Choose something that will be fun, interactive, challenging, and do-able.