Dept. Colloquiua

CS 120   Computer Science I,  Fall 2006,  Instructor:  Jeffrey Horn


COURSE ANNOUNCEMENTS (Tuesday, December 12, 2006)                  


CONTENTS


LECTURE NOTES


  • HOMEWORKS & PROGRAMS
  •  

     

    Homework 5:   "Honeycombs (Hex paper)"

    Program II:  "Handling Java Events:  Buttons and Mice"

  • Handed out Thursday, November 2, 2006 
  • Due:  Friday, Nov. 17, 2006,end of day
  • Purpose:  Learn
    1. the Java event model
    2. button input
    3. state variables
  • Example Code (we developed this in class):
  • Original FollowTheClick  (hacked up in class)
  • Simplified FollowTheClick
  • Simple Use of Buttons
  • Trisha's code
  • Image code
  • Audio code
  • Assignment:
    1. Copy this "template code" to a new folder
    2. Make a graphical guessing game with the following functionality
      • The game is to make the user guess where the hidden box is by clicking on the screen.
      • We will give the user hints each time he/she clicks and misses by displaying a line or arrow that indicates which direction the hidden box is from their click.
      • Create a random coordinate (sx,sy).  Imagine a "secret" box of width and height 20 at (sx,sy) (5pts).
      • Centered the hidden (secret) box at (sx,sy) by drawing it from (sx-10,sy-10) to (sx+10,sy+10).   (See "centering graphics" in section 2.5 on page 2-14)  (5 pt.s)
      • Listen for a mousepressed mouse event. 
      • If your player clicks within the magic box centered at (x,y), then display the box (make it visible).  (see section 2.3, "Expressions" on page 2-11 and also section 3.4 on page 3-8 for boolean expressions) (10 pts.)
      • If your player misses with the click, then update the "hints".
      • Hints to give the player:    (not cumulative!  )
        1. Use clues, like arrows, at fixed location (10 pt.sExample (applet)
        2. Use arrows that follow the click (20 ptsExample (applet)
        3. Use vertical and horizontal lines that define all four limits (30 pt.s) Example (applet)
        4. Use a box that defines all four sides (40 pt.s):   Example (applet)
      •  Maintain and print (on the graphics screen!) the number of clicks so far.  (10 pts.)
      • Use an external file (like gif, jpg, or bmp) for your hidden box (10 pts)  Get your own!
      • Play some music (or other sound) when the player clicks (maybe upon winning, or upon missing, or both)  (10 pts)  Get your own!
  •  



    PROGRAMMING

     


    TESTS AND QUIZZES



     

    FINAL