CS211 Spring 2007 Assignment 5 Pacman Due Thursday, 3 May 2007, 11:59:59pm. 1 General Instructions. 2 Overview. 2.1 Background. 2.

Size: px
Start display at page:

Download "CS211 Spring 2007 Assignment 5 Pacman Due Thursday, 3 May 2007, 11:59:59pm. 1 General Instructions. 2 Overview. 2.1 Background. 2."

Transcription

1 CS211 Spring 2007 Assignment 5 Pacman 1 General Instructions In this assignment, you will develop a Java implementation of the famous interactive game Pacman. This assignment will involve GUI programming, threads and concurrency, and graphs. This is the most extensive assignment yet. There are two common required exercises, namely the implementation of Dijkstra s shortest-path algorithm and its application in the Pacman game to supply artificial intelligence for the ghost behavior. In addition, there are several optional exercises that you may choose from. Finally, we will have a contest for the best game as judged by the course staff, with a prize to be awarded at the final exam. This assignment should be a lot of fun, but it will also be a lot of work, so don t wait until the last minute to get started. As before, you may work in pairs. Please follow the instructions on the website for selecting a partner. You must create a group in CMS for yourself and your partner. 2 Overview 2.1 Background Pacman is a traditional arcade game that was first produced by a Japanese company Namco and first appeared on the scene in If you have never played Pacman before (this is a bit like saying if you have never heard the Beatles before... ), there is a good online version available at flash/. Our version is modeled on the original. 2.2 Getting Started Download an unpack the supplied archive A5Release.zip, which contains the assignment code, and the file A5Solution.jar, which contains our solution. Play with the online version and/or our version a bit to get a feel for the game. You can run from the command line using javaw -jar A5Solution.jar, or in Windows, just double-click on the.jar file. Use the command line option -s to run silently if the sound effects are not to your liking. 2.3 Structure of the Application When you unzip A5Release.zip, the first thing you will notice is the division of the code into several folders. Here we have used the Java package structure to organize the numerous classes that are needed in a logical way. The game package contains the code for the game engine that handles all the actor, map and player functionality. The gui package creates the pacman application and handles drawing and user input. Of particular interest for you is the graph package. In here you will find the Graph interface that you must implement. From a code standpoint, the game runs very much like a real game would. Within the GUI class, there is an Animator class that runs on a separate thread. It contains an infinite while loop that repeatedly calculates the time passed since the last loop and then updates the unit locations, checks for collisions, and repaints the background and actors. Because we never really know how fast this game loop will run, we use the time difference since the last phase to move the units based on the time that has passed. If one iteration takes longer, we move the units farther. The map used by the game is created based on the text file in bin/resources/maps. The text file specifies what type of cell should be placed in each location, including walls and non-navigable areas. The classes PacmanMap and Background create the necessary images and draw them when called. The PacmanMap page 1/7

2 class knows where actors should be allowed to go and where there is a wall, and it stores this information in a Graph (which you will be writing). Each iteration of the game loop requires a check to see where the units should be moving. There are two classes that handle this, namely LocalPlayer and AIPlayer. The LocalPlayer class is event-driven and implements KeyListener. It is alerted each time the user pushes an arrow button. When this occurs, it uses the adddirection function in the Pacman class to enqueue the next direction that the pacman should travel. The AIPlayer class is where you will use your graph code to find the shortest path to the pacman, and then give each ghost directions to the pacman based on where they are. The Game class is the glue that holds everything together. It interacts closely with the GUI class, handling key and timer events generated by the user and the program. It translates these events into commands for all the other classes in the game. 3 Graphs, Shortest Paths, and Dijkstra s Algorithm Purpose: Graphs as a data structure, implementation of graph algorithms, Dijkstra s shortest path algorithm Estimated time: 25 hours Points: 75 In this exercise, you will build a graph representing the navigable portion of the board and implement Dijkstra s shortest path algorithm. 3.1 Building The Graph The navigable areas of the game board can be represented as an undirected graph whose nodes are the navigable cells and whose edges connect adjacent pairs of cells. The classes Node, Edge, and Path are provided. You need to implement the methods in the file MapGraph.java using these classes The Node Class All nodes will have a unique number id, along with their two position coordinates x, y. Each node will also have a Vector of its neighboring nodes The Edge Class Similarly, all edges have a unique number id (which is not related to any node s id), two Nodes which are its endpoints, and a weight, which can be interpreted as the distance along that edge The Path Class The Path class consists of a Vector of nodes. Whenever you create a new Path object, it is initially empty. You can then add nodes to this path (in order) using the appendnode(node v) method. The path always starts at the beginning (currentprogress = 0) and will advance currentprogress by 1 every time you call the advance() method. The class Path implements the Iterable interface. This means it has a method iterator() that will return an iterator of Nodes starting from wherever currentprogress is all the way to the end of the path. The method reverse(path p) will return the path in reverse order. This newly returned Path will have its currentprogress field set to The MapGraph Class The MapGraph class will implement the interface Graph, which defines all the methods you need, along with the asymptotic complexity we expect to see. You must implement these methods. If your algorithms exceed the given runtimes, they will have bad effects on the speed of the game. page 2/7

3 You may implement utility classes and helper methods to assist in your methods. You are also allowed to import and use anything from the Java API Access Methods public abstract int addnode(int x, int y) This method will take a position x, y and add a Node at that position to the data structure(s) containing your nodes, as long as one does not already exist. If there is already a node at that position, it will not add the new node, and will just return 1. Otherwise it will add the node and return this node s id. Note that this function should take at most O(log n) time, where n is the number of nodes in the graph. This means just keeping all your nodes in an ArrayList is not going to be enough, because searching through an ArrayList to check if the element is already there would take O(n) time in the worst case. public abstract Node getnodebyid(int id) It should be possible to retrieve a Node given its id in constant (O(1)) time. This method returns null if the Node does not exist. public abstract Node getnodebycoord(int x, int y) This method is very similar to getnodebyid. This method is expected to run in at most O(log n) time. Again, this means that you do not have enough time to go through a list of nodes and check each coordinate. This method should return null if the Node does not exist at that point. public abstract int nodecount() It should run in constant time. This method returns the number of nodes currently in your graph. public abstract int addedge(int nid1, int nid2, double weight) This is very similar to addnode. It will take in two node ids and a weight. It will then check to see if this Edge already exists. If it already exists, or if adding this edge would form a self-loop (an edge whose two endpoints are the same Node), this method will return 1, otherwise it will add the Edge and return the id of the newly created edge. public abstract Edge getedgebyid(int id) Similar to the corresponding method for Nodes. public abstract Edge getedgebyendpoints(node v1, Node v2) This method will return an Edge with endpoints v1 and v2. This is expected to run in at most O(log n) time, so again, linear search is out of the question. The method should return null if there is no such Edge in the graph. public abstract int edgecount() to run in constant time. Returns the number of edges currently in the graph. It is expected Graph Algorithms public abstract double pathweight(path p) This method will take a Path p and determine the weight of the path as a whole. This is the sum of the weights of all the edges along the path. This should run in time O(n log n). This will return INFINITY if the path is empty. The value INFINITY is a predefined constant defined in the MapGraph class. public abstract Path shortestpath(node src, Node dst) This is where all the hard work is. Given a source and a destination, this method should use Dijkstra s algorithm to find the shortest path from src to dst. It should return null if there is no such path. This should run in time O(n log n). page 3/7

4 3.2 The AI Moving the Ghosts Now you will use your implementation of Dijkstra s algorithm to help the ghosts capture Pacman. In AIPlayer, call your implementation of Dijkstra s algorithm from the run() method of the MoveGhostTask inner class to determine the shortest path from each ghost to Pacman. Each ghost will take the shortest path to Pacman unless it is vulnerable or recovering. In the case that the ghost is vulnerable or recovering, the ghost should try to get away from Pacman by taking the opposite direction from the shortest path direction. Otherwise, it should move in the direction of the shortest path to Pacman. To move the ghost in some direction, use the method adddirection(movementdirection nextdirection) from the Ghost class. To get the next direction from the path, start with the location of the first node in the path and the ghost s current location, use the method getdirection(int x, int y) from the PacmanMap class, where x and y are the differences between the x,y coordinates of the first node in the path and the ghost s current location. You will want to change the timing of the calculation of these shortest paths. Right now the ghosts are programmed to move in random directions, and to choose a new random direction every 2 seconds (2000 milliseconds, as specified by the value of calculationinterval). Once you get your AI code working, you will want to shorten the time between successive shortest-path calculations. In our solution, we have calculationinterval set to 50 milliseconds PacmanMap In PacmanMap, there is some code that needs to be uncommented in the constructor after you finish implementing MapGraph. The code constructs the graph using the MapGraph. /* * Creates the graph representation of this map. */ /*REMOVE THE FOLLOWING COMMENT and make the code active after you write the graph class */ 4 Enhancements Purpose: To have fun and exercise your creativity Estimated time: The sky s the limit Points: 25+ In addition to implementing Dijkstra s algorithm and the AI for ghosts, we ask that you enhance the game by adding at least one extra feature. This part is designed for you to have fun with the project while experimenting with the different features of the Java language. Dijkstra s algorithm and the AI are worth 75 points. This section allows you to make up the remaining 25. Feel free to do any of the enhancements we list and as many as you like, but keep in mind that the max grade for this assignment is 100 points. Points in excess of 100 will be counted as bonus points. Those might be important at the end of the semester if you are on or slightly below a certain letter grade cutoff. The following list gives enhancements that we have thought of and the points that they are worth. You may also come up with your own ideas. If you come up with something that you would like to do that is not on the list, please contact one of the instructors or TAs assigned to this project to negotiate the number of points you will get for it. The number of points should be in line with those listed in the list below. We will award a prize at the final exam for the best game as judged by the course staff. 4.1 Keep Score - 10 points Assign point values to actions in the game: eating a ghost, eating dots, eating cherries (if you implement them), etc. Keep track and display the score somewhere in the game itself, but do so gracefully. The score should not take over an important part of the game screen, nor should it be in a place where it is difficult to find. page 4/7

5 4.2 Lives, game over screen - 10 points Right now, Pacman has infinitely many lives and the game ends when the user quits the application. Implement Pacman to have a fixed number of lives (say 3). Everytime Pacman dies, update the number of remaining lives (you should keep this number visible somewhere on the game screen). If Pacman is out of lives, display a game over screen and allow the user to start a new game Pacmen - 20 points Add another Pacman to the map so that a single user controls both at the same time. Bind another set of keys (say W,A,S,D) to move the second Pacman. The second Pacman should interact in exactly the same way as the original one and follow the same game rules (i.e., it eats dots, is vulnerable to ghosts, can get powerup, etc). 4.4 Levels - 20 points Add extra levels to the game. When Pacman completes a level (by eating all the dots), go on to the next level. The AI for the ghosts should also get better with every new level. One way to do this is to increase the attention span of the ghosts. If you do something more involved or more interesting, we may be inclined to award more points. Implement a minimum of 3 levels to get the full points. 4.5 Scaling AI of ghosts - 10 points If you do not wish to create extra levels, you may still implement a harder AI for the ghosts (you can ask for a difficulty level before the start of the game in a dialog box). If you create an AI that is more involved than the improvement we described in Section 4.4, then we will be inclined to award more points. 4.6 High Scores - 10 points Save scores to a file. Keep track of the top 10. Display them after the end of the game (so you need a notion of end game ). 4.7 Splash Screen - 10 points If you implement High Scores or Scaling (Sections 4.6 or 4.5), you may add a splash screen at the beginning of the game. It should allow players to start a new game, see high scores or set the AI of ghosts and possible set other options that you may have implemented. Feel free to get rid of the bottom bar with the start button and have the game cover the whole window. 4.8 Color Schemes - 10 points Allow a user to select different color schemes. The color schemes should change the color of the background, walls, items in the game and ghosts and pacman themselves. Perhaps place a photo in the back instead of a background. 4.9 New Items - variable We have subdivided items into two categories: ones that take effect immediately and ones that you can save for later use. The immediate items are those that if Pacman (or Ghost) touches, immediately perform their effect (example is the powerup). You will get 5 points for the first item you implement and then 2 more for any subsequent ones. Immediate items: Ghost Freeze - all ghosts stop in place if Pacman walks over this item page 5/7

6 Turbo Speed - Pacman moves very quickly around the board Slow Speed - Pacman moves very slowly around the board Slow Ghosts - all Ghosts move very slowly around the board Turbo Ghosts - all Ghosts move very quickly around the board Warp - Pacman warps to a random location on the board All tokens reappear - all eaten dots reappear and Pacman has to eat them again Cherry - just like in the original Pacman Saveable items are those that a Pacman picks up and can use at a later point. You need to display those items to the user in some way and bind a key (such as the spacebar) so that Pacman uses the next item (you may also want to bind another key to destroy or get rid of an item already stored). These will gain you 7 points for the first and 2 more for each additional one. Saveable items: summon a friendly ghost - use your imagination mines - drop a mine. If a ghost goes over it - BOOM! turn into a Ghost - turn yourself into a Ghost. Other ghosts stop chasing you and can t hurt you if they touch you. On the other hand you can t eat any dots. This effect should be temporary (and could be implemented as an immediate item). You may add any other items here that you think of for the same amount of points as described above Pacman AI - 50 points Implement an AI for Pacman (so essentially the computer plays itself). The Pacman should try to eat all the dots while avoiding Ghosts. For this one, simply picking a random direction to walk in will not work. You must really put some thought into this and think about how to make Pacman try to avoid the Ghosts. You must also describe the algorithm you used in detail so that it convinces us you put significant effort into this part. Partial credit will be awarded, but it will be based on subjective judging D Pacman - 50 points Use your imagination Network Pacman points Let a user control Pacman and networked users control Ghosts. Try to balance out the game so that it is not too easy to capture the Pacman. Borrow the code from Assignment All your base are belong to us! - 1 point Test out your humor skills by throwing in an All your base are belong to us reference somewhere in the game. page 6/7

7 5 What to Submit Please read this section carefully! We will first test just your Dijkstra s algorithm code and the ghost AI plugged into our solution code. Then we will run your whole code to grade the enhancements. Please submit the following files in CMS: Exercise 3: Exercise3.zip Exercise 4: Exercise4.zip Do not submit any other files. The file Exercise3.zip should be a.zip archive containing at least MapGraph.java, AIPlayer.java, PacmanMap.java, and any other.java file you create or modify. If you include any other files besides the three mentioned, please also include a plain text file readme.txt describing how and why you modified them. The file Exercise4.zip should be a.zip archive containing all of your source code (including any files already included in Exercise3.zip, so you essentially submit them twice), along with a file readme.txt. The reason we are asking for all your files in Exercise4.zip is that you may want to submit basic versions for the Dijkstra problem and highly modified versions for your enhancements. The file readme.txt in Exercise4.zip should be in plain text format and should have the following information: 1. how to compile and run the game (write as provided if you did not modify this); 2. features that you added, along with a description of how you implemented them. In your description, please describe what modifications you made to the original code to get the features to work and the algorithms that you used to get those features to work (you will not get credit if you do not explain the algorithms). Here, we are not looking for lines of code that you modified, but rather which classes you modified and what those modifications were. For example: We modified the game class to have a global variable that keeps track of the current score. We also modified each of the items to have a score variable for that item. Whenever an action is performed on one of those items, we update the game score to reflect this. Finally, we modified the GUI to display the score in the bottom right hand corner. We hope you enjoy doing this assignment as much as we enjoyed putting it together! page 7/7

Major Assignment: Pacman Game

Major Assignment: Pacman Game Major Assignment: Pacman Game 300580 Programming Fundamentals Week 10 Assignment The major assignment involves producing a Pacman style game with Clara using the Greenfoot files that are given to you.

More information

CSE373 Fall 2013, Second Midterm Examination November 15, 2013

CSE373 Fall 2013, Second Midterm Examination November 15, 2013 CSE373 Fall 2013, Second Midterm Examination November 15, 2013 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please

More information

Notebook Assignments

Notebook Assignments Notebook Assignments These six assignments are a notebook using techniques from class in the single concrete context of graph theory. This is supplemental to your usual assignments, and is designed for

More information

CS 4349 Lecture October 18th, 2017

CS 4349 Lecture October 18th, 2017 CS 4349 Lecture October 18th, 2017 Main topics for #lecture include #minimum_spanning_trees. Prelude Homework 6 due today. Homework 7 due Wednesday, October 25th. Homework 7 has one normal homework problem.

More information

CSE332 Summer 2010: Final Exam

CSE332 Summer 2010: Final Exam CSE332 Summer 2010: Final Exam Closed notes, closed book; calculator ok. Read the instructions for each problem carefully before answering. Problems vary in point-values, difficulty and length, so you

More information

CS61BL: Data Structures & Programming Methodology Summer Project 1: Dots!

CS61BL: Data Structures & Programming Methodology Summer Project 1: Dots! CS61BL: Data Structures & Programming Methodology Summer 2014 Project 1: Dots! Note on compiling Board.java You will not be able to compile Board.java until you make your own CantRemoveException class.

More information

A simple problem that has a solution that is far deeper than expected!

A simple problem that has a solution that is far deeper than expected! The Water, Gas, Electricity Problem A simple problem that has a solution that is far deeper than expected! Consider the diagram below of three houses and three utilities: water, gas, and electricity. Each

More information

Scratch Lesson 2: Movies Made From Scratch Lesson Framework

Scratch Lesson 2: Movies Made From Scratch Lesson Framework Scratch Lesson 2: Movies Made From Scratch Lesson Framework Scratch makes it easy to program your own interactive stories, games, and animations and share your creations on the web. As you create and share

More information

Prelim 2. CS 2110, November 20, 2014, 7:30 PM Extra Total Question True/False Short Answer

Prelim 2. CS 2110, November 20, 2014, 7:30 PM Extra Total Question True/False Short Answer Prelim 2 CS 2110, November 20, 2014, 7:30 PM 1 2 3 4 5 Extra Total Question True/False Short Answer Complexity Induction Trees Graphs Extra Credit Max 20 10 15 25 30 5 100 Score Grader The exam is closed

More information

Our second exam is Monday, April 3. Note that it will not be possible to get all the homework submissions graded before the exam.

Our second exam is Monday, April 3. Note that it will not be possible to get all the homework submissions graded before the exam. Com S 227 Spring 2017 Assignment 3 300 points Due Date:, Wednesday, March 29 11:59 pm (midnight) Late deadline (25% penalty): Thursday, March 30, 11:59 pm General information This assignment is to be done

More information

Our second exam is Thursday, November 10. Note that it will not be possible to get all the homework submissions graded before the exam.

Our second exam is Thursday, November 10. Note that it will not be possible to get all the homework submissions graded before the exam. Com S 227 Fall 2016 Assignment 3 300 points Due Date: Wednesday, November 2, 11:59 pm (midnight) Late deadline (25% penalty): Thursday, November 2, 11:59 pm General information This assignment is to be

More information

CS 351: Design of Large Programs.

CS 351: Design of Large Programs. Welcome to CS 351 Design of Large Programs Instructor: Joel Castellanos e-mail: joel@unm.edu Web: http://cs.unm.edu/~joel/ Office: Electrical and Computer Engineering building (ECE). Room 233 1/18/2017

More information

CMPSCI 187 / Spring 2015 Hangman

CMPSCI 187 / Spring 2015 Hangman CMPSCI 187 / Spring 2015 Hangman Due on February 12, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI 187 / Spring 2015 Hangman Contents Overview

More information

ASSIGNMENT 5 Objects, Files, and a Music Player

ASSIGNMENT 5 Objects, Files, and a Music Player ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you

More information

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency.

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency. Description of CPSC 301: This is a 2-unit credit/no credit course. It is a course taught entirely in lab, and has two required 2-hour 50-minute lab sessions per week. It will review, reinforce, and expand

More information

Lab 1 Implementing a Simon Says Game

Lab 1 Implementing a Simon Says Game ECE2049 Embedded Computing in Engineering Design Lab 1 Implementing a Simon Says Game In the late 1970s and early 1980s, one of the first and most popular electronic games was Simon by Milton Bradley.

More information

Lab 1 Implementing a Simon Says Game

Lab 1 Implementing a Simon Says Game ECE2049 Embedded Computing in Engineering Design Lab 1 Implementing a Simon Says Game In the late 1970s and early 1980s, one of the first and most popular electronic games was Simon by Milton Bradley.

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 31 Static Members Welcome to Module 16 of Programming in C++.

More information

ASSIGNMENT 5 Objects, Files, and More Garage Management

ASSIGNMENT 5 Objects, Files, and More Garage Management ASSIGNMENT 5 Objects, Files, and More Garage Management COMP-202B, Winter 2010, All Sections Due: Wednesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified,

More information

(Refer Slide Time: 02.06)

(Refer Slide Time: 02.06) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 27 Depth First Search (DFS) Today we are going to be talking

More information

Project 3: Implementing a List Map

Project 3: Implementing a List Map Project 3: Implementing a List Map CSCI 245 Programming II: Object-Oriented Design Spring 2017 Devin J. Pohly (adapted from Thomas VanDrunen) This project has two main goals: To give you practice in implementing

More information

CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM

CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM Introduction to the Assignment In this lab, you will finish the program to allow a user to solve Sudoku puzzles.

More information

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CMSC 201 Fall 2016 Lab 09 Advanced Debugging CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working

More information

CMPSCI 187 / Spring 2015 Hanoi

CMPSCI 187 / Spring 2015 Hanoi Due on Thursday, March 12, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 Contents Overview 3 Learning Goals.................................................

More information

Prelim 2 Solutions. CS 2110, November 20, 2014, 7:30 PM Extra Total Question True/False Short Answer

Prelim 2 Solutions. CS 2110, November 20, 2014, 7:30 PM Extra Total Question True/False Short Answer Prelim 2 Solutions CS 2110, November 20, 2014, 7:30 PM 1 2 3 4 5 Extra Total Question True/False Short Answer Complexity Induction Trees Graphs Extra Credit Max 20 10 15 25 30 5 100 Score Grader The exam

More information

CSE332 Summer 2012 Final Exam, August 15, 2012

CSE332 Summer 2012 Final Exam, August 15, 2012 Name: UW NetID: CSE332 Summer 2012 Final Exam, August 15, 2012 Please do not turn the page until the bell rings. Rules: The exam is closed-book and limited-note. You are permitted a single, handwritten

More information

Core Competency DOO (Design Object-Oriented)

Core Competency DOO (Design Object-Oriented) Here is the documentation for the rest of the semester. This document includes specification of the remaining Core Competencies, specifications for the final two Core Labs, and specifications for a number

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Fall 2018 Miniassignment 1 40 points Due Date: Friday, October 12, 11:59 pm (midnight) Late deadline (25% penalty): Monday, October 15, 11:59 pm General information This assignment is to be done

More information

ASSIGNMENT 4 Classes and Objects

ASSIGNMENT 4 Classes and Objects ASSIGNMENT 4 Classes and Objects COMP-202A, Fall 2010, All Sections Due: Friday, November 19, 2010 (23:55) You MUST do this assignment individually and, unless otherwise specified, you MUST follow all

More information

Platform Games Drawing Sprites & Detecting Collisions

Platform Games Drawing Sprites & Detecting Collisions Platform Games Drawing Sprites & Detecting Collisions Computer Games Development David Cairns Contents Drawing Sprites Collision Detection Animation Loop Introduction 1 Background Image - Parallax Scrolling

More information

1.2 Adding Integers. Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line

1.2 Adding Integers. Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line 1.2 Adding Integers Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line Finding Sums Mentally The Commutative Property Finding Sums using And Patterns and Rules of Adding Signed

More information

CIS 121 Data Structures and Algorithms with Java Spring 2018

CIS 121 Data Structures and Algorithms with Java Spring 2018 CIS 121 Data Structures and Algorithms with Java Spring 2018 Homework 2 Thursday, January 18 Due Monday, January 29 by 11:59 PM 7 Required Problems (85 points), and Style and Tests (15 points) DO NOT modify

More information

Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1

Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1 Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1 This assignment, including much of the wording of this document, is taken from an assignment from Stanford University, by Professor Eric Roberts.

More information

CS 201 Advanced Object-Oriented Programming Lab 3, Asteroids Part 1 Due: February 17/18, 11:30 PM

CS 201 Advanced Object-Oriented Programming Lab 3, Asteroids Part 1 Due: February 17/18, 11:30 PM CS 201 Advanced Object-Oriented Programming Lab 3, Asteroids Part 1 Due: February 17/18, 11:30 PM Objectives to gain experience using inheritance Introduction to the Assignment This is the first of a 2-part

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Fall 2017 Miniassignment 1 50 points Due Date: Monday, October 16, 11:59 pm (midnight) Late deadline (25% penalty): Tuesday, October 17, 11:59 pm General information This assignment is to be

More information

Lab 1- Introduction to Motion

Lab 1- Introduction to Motion Partner : Purpose Partner 2: Lab - Section: The purpose of this lab is to learn via a motion detector the relationship between position and velocity. Remember that this device measures the position of

More information

PA101 Learning the Ropes

PA101 Learning the Ropes Synopsis PA101 Learning the Ropes This first PA is going to be rather unusual. In the upcoming week, you will generally have a single program to write for the whole assignment. This time we are going to

More information

Jerry Cain Handout #5 CS 106AJ September 30, Using JSKarel

Jerry Cain Handout #5 CS 106AJ September 30, Using JSKarel Jerry Cain Handout #5 CS 106AJ September 30, 2017 Using JSKarel This handout describes how to download and run the JavaScript version of Karel that we ll be using for our first assignment. 1. Getting started

More information

Assignment 5: Part 1 (COMPLETE) Sprites on a Plane

Assignment 5: Part 1 (COMPLETE) Sprites on a Plane Assignment 5: Part 1 (COMPLETE) Sprites on a Plane COMP-202B, Winter 2011, All Sections Due: Wednesday, April 6, 2011 (13:00) This assignment comes in TWO parts. Part 2 of the assignment will be published

More information

Programming assignment A

Programming assignment A Programming assignment A ASCII Minesweeper Official release on Feb 14 th at 1pm (Document may change before then without notice) Due 5pm Feb 25 th Minesweeper is computer game that was first written in

More information

Improving the Crab more sophisticated programming

Improving the Crab more sophisticated programming CHAPTER 3 Improving the Crab more sophisticated programming topics: concepts: random behavior, keyboard control, sound dot notation, random numbers, defining methods, comments In the previous chapter,

More information

Lab Exercise 6: Abstract Classes and Interfaces CS 2334

Lab Exercise 6: Abstract Classes and Interfaces CS 2334 Lab Exercise 6: Abstract Classes and Interfaces CS 2334 September 29, 2016 Introduction In this lab, you will experiment with using inheritance in Java through the use of abstract classes and interfaces.

More information

CS1132 Fall 2009 Assignment 1. 1 The Monty Hall Dillemma. 1.1 Programming the game

CS1132 Fall 2009 Assignment 1. 1 The Monty Hall Dillemma. 1.1 Programming the game CS1132 Fall 2009 Assignment 1 Adhere to the Code of Academic Integrity. You may discuss background issues and general solution strategies with others and seek help from course staff, but the homework you

More information

CS 134 Test Program #2

CS 134 Test Program #2 CS 134 Test Program #2 Sokoban Objective: Build an interesting game using much of what we have learned so far. This second test program is a computer maze game called Sokoban. Sokoban is a challenging

More information

CSC D84 Assignment 2 Game Trees and Mini-Max

CSC D84 Assignment 2 Game Trees and Mini-Max 0 The Cats Strike Back Due date: Wednesday, Feb. 21, 9am (electronic submission on Mathlab) This assignment can be completed individually, or by a team of 2 students This assignment is worth 10 units toward

More information

Assignment 8: Sokoban

Assignment 8: Sokoban Assignment 8: Sokoban Algorithmic Thinking and Structured Programming (in Greenfoot) c 2015 Renske Smetsers-Weeda & Sjaak Smetsers Licensed under the Creative Commons Attribution 4.0 license, https://creativecommons.org/licenses/by/4.0/

More information

CMPSCI 187 / Spring 2015 Postfix Expression Evaluator

CMPSCI 187 / Spring 2015 Postfix Expression Evaluator CMPSCI 187 / Spring 2015 Postfix Expression Evaluator Due on Thursday, 05 March, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI 187 / Spring 2015

More information

Excel Basics Fall 2016

Excel Basics Fall 2016 If you have never worked with Excel, it can be a little confusing at first. When you open Excel, you are faced with various toolbars and menus and a big, empty grid. So what do you do with it? The great

More information

PROBLEM SOLVING 11. July 24, 2012

PROBLEM SOLVING 11. July 24, 2012 PROBLEM SOLVING 11 COMPUTER SCIENCE 61A July 24, 2012 Today s section will be a kind of Meta-Section, we are going to walk through some medium to hard-ish problems in Scheme, and we will discuss some methods

More information

[ the academy_of_code] Senior Beginners

[ the academy_of_code] Senior Beginners [ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell

More information

CS 2110 Summer 2011: Assignment 2 Boggle

CS 2110 Summer 2011: Assignment 2 Boggle CS 2110 Summer 2011: Assignment 2 Boggle Due July 12 at 5pm This assignment is to be done in pairs. Information about partners will be provided separately. 1 Playing Boggle 1 In this assignment, we continue

More information

CSE 332 Winter 2018 Final Exam (closed book, closed notes, no calculators)

CSE 332 Winter 2018 Final Exam (closed book, closed notes, no calculators) Name: Sample Solution Email address (UWNetID): CSE 332 Winter 2018 Final Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering.

More information

CS2110 Assignment 2 Lists, Induction, Recursion and Parsing, Summer

CS2110 Assignment 2 Lists, Induction, Recursion and Parsing, Summer CS2110 Assignment 2 Lists, Induction, Recursion and Parsing, Summer 2008 Due Thursday July 3, 2008, 6:00PM 0 General Instructions 0.1 Purpose This assignment will help you solidify your knowledge of Java

More information

Remaining Enhanced Labs

Remaining Enhanced Labs Here are some announcements regarding the end of the semester, and the specifications for the last Enhanced Labs. Don t forget that you need to take the Common Final Examination on Saturday, May 5, from

More information

Tips from the experts: How to waste a lot of time on this assignment

Tips from the experts: How to waste a lot of time on this assignment Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be

More information

Com S 227 Assignment Submission HOWTO

Com S 227 Assignment Submission HOWTO Com S 227 Assignment Submission HOWTO This document provides detailed instructions on: 1. How to submit an assignment via Canvas and check it 3. How to examine the contents of a zip file 3. How to create

More information

1. O(log n), because at worst you will only need to downheap the height of the heap.

1. O(log n), because at worst you will only need to downheap the height of the heap. These are solutions for the practice final. Please note that these solutions are intended to provide you with a basis to check your own answers. In order to get full credit on the exam, you must show all

More information

CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists

CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists Due on Tuesday February 24, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI

More information

CS 134 Programming Exercise 9:

CS 134 Programming Exercise 9: CS 134 Programming Exercise 9: Nibbles Objective: To gain experience working with 2 dimensional arrays. The Problem Nibbles is a snake. Nibbles moves around a field, looking for food. Unfortunately, Nibbles

More information

FiberMesh. Due: 4/12/10, 11:59 PM

FiberMesh. Due: 4/12/10, 11:59 PM CS224: Interactive Computer Graphics FiberMesh Due: 4/12/10, 11:59 PM Least Squares Solver 5 Mesh triangulation 10 Optimization Problem 1: Curve Dragging 25 Optimization Problem 2: Surface Optimization

More information

CS211 Computers and Programming Matthew Harris and Alexa Sharp July 9, Boggle

CS211 Computers and Programming Matthew Harris and Alexa Sharp July 9, Boggle Boggle If you are not familiar with the game Boggle, the game is played with 16 dice that have letters on all faces. The dice are randomly deposited into a four-by-four grid so that the players see the

More information

Pacman. you want to see how the maze was created, open the file named unity_pacman_create_maze.

Pacman. you want to see how the maze was created, open the file named unity_pacman_create_maze. Pacman Note: I have started this exercise for you so you do not have to make all of the box colliders. If you want to see how the maze was created, open the file named unity_pacman_create_maze. Adding

More information

Total Score /15 /20 /30 /10 /5 /20 Grader

Total Score /15 /20 /30 /10 /5 /20 Grader NAME: NETID: CS2110 Fall 2009 Prelim 2 November 17, 2009 Write your name and Cornell netid. There are 6 questions on 8 numbered pages. Check now that you have all the pages. Write your answers in the boxes

More information

CS 4349 Lecture August 21st, 2017

CS 4349 Lecture August 21st, 2017 CS 4349 Lecture August 21st, 2017 Main topics for #lecture include #administrivia, #algorithms, #asymptotic_notation. Welcome and Administrivia Hi, I m Kyle! Welcome to CS 4349. This a class about algorithms.

More information

(Refer Slide Time: 1:27)

(Refer Slide Time: 1:27) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 1 Introduction to Data Structures and Algorithms Welcome to data

More information

Soda Machine Laboratory

Soda Machine Laboratory Soda Machine Laboratory Introduction This laboratory is intended to give you experience working with multiple queue structures in a familiar real-world setting. The given application models a soda machine

More information

CS2110 Assignment 3 Inheritance and Trees, Summer 2008

CS2110 Assignment 3 Inheritance and Trees, Summer 2008 CS2110 Assignment 3 Inheritance and Trees, Summer 2008 Due Sunday July 13, 2008, 6:00PM 0 Introduction 0.1 Goals This assignment will help you get comfortable with basic tree operations and algorithms.

More information

TOOLS AND TECHNIQUES FOR TEST-DRIVEN LEARNING IN CS1

TOOLS AND TECHNIQUES FOR TEST-DRIVEN LEARNING IN CS1 TOOLS AND TECHNIQUES FOR TEST-DRIVEN LEARNING IN CS1 ABSTRACT Test-Driven Development is a design strategy where a set of tests over a class is defined prior to the implementation of that class. The goal

More information

Simple Graph. General Graph

Simple Graph. General Graph Graph Theory A graph is a collection of points (also called vertices) and lines (also called edges), with each edge ending at a vertex In general, it is allowed for more than one edge to have the same

More information

CSE373 Winter 2014, Final Examination March 18, 2014 Please do not turn the page until the bell rings.

CSE373 Winter 2014, Final Examination March 18, 2014 Please do not turn the page until the bell rings. CSE373 Winter 2014, Final Examination March 18, 2014 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please stop promptly

More information

CMSC 341 Hashing (Continued) Based on slides from previous iterations of this course

CMSC 341 Hashing (Continued) Based on slides from previous iterations of this course CMSC 341 Hashing (Continued) Based on slides from previous iterations of this course Today s Topics Review Uses and motivations of hash tables Major concerns with hash tables Properties Hash function Hash

More information

Improving the crab: more sophisticated programming

Improving the crab: more sophisticated programming Chapter 3 Improving the crab: more sophisticated programming topics: concepts: random behavior, keyboard control, sound dot notation, random numbers, defining methods, comments In the previous chapter,

More information

UNINFORMED SEARCH. Announcements Reading Section 3.4, especially 3.4.1, 3.4.2, 3.4.3, 3.4.5

UNINFORMED SEARCH. Announcements Reading Section 3.4, especially 3.4.1, 3.4.2, 3.4.3, 3.4.5 UNINFORMED SEARCH Announcements Reading Section 3.4, especially 3.4.1, 3.4.2, 3.4.3, 3.4.5 Robbie has no idea where room X is, and may have little choice but to try going down this corridor and that. On

More information

Chapter 10 Recursion

Chapter 10 Recursion Chapter 10 Recursion Written by Dr. Mark Snyder [minor edits for this semester by Dr. Kinga Dobolyi] Recursion implies that something is defined in terms of itself. We will see in detail how code can be

More information

Assignment 4. Aggregate Objects, Command-Line Arguments, ArrayLists. COMP-202B, Winter 2011, All Sections. Due: Tuesday, March 22, 2011 (13:00)

Assignment 4. Aggregate Objects, Command-Line Arguments, ArrayLists. COMP-202B, Winter 2011, All Sections. Due: Tuesday, March 22, 2011 (13:00) Assignment 4 Aggregate Objects, Command-Line Arguments, ArrayLists COMP-202B, Winter 2011, All Sections Due: Tuesday, March 22, 2011 (13:00) You MUST do this assignment individually and, unless otherwise

More information

CPSC 217 Assignment 3

CPSC 217 Assignment 3 CPSC 217 Assignment 3 Due: Monday November 26, 2018 at 12:00 noon Weight: 7% Sample Solution Length: Approximately 120 lines, including blank lines, lots of comments and the provided code Individual Work:

More information

CMSC132, Practice Questions

CMSC132, Practice Questions CMSC132, Practice Questions Notice the final exam can include material not covered by the practice questions. You should practice beyond what is covered in this document. Although solutions will not be

More information

CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings.

CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings. CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please stop promptly

More information

Animation Workshop. Support Files. Advanced CODING CHALLENGE - ADVANCED

Animation Workshop. Support Files. Advanced CODING CHALLENGE - ADVANCED Animation Workshop Support Files Greenfoot Application: Greenfoot.org/download Greenfoot Reference: Greenfoot.org/files/javadoc/Greenfoot/package-summary Template: Scholastic.com/samsungacademy/resources/animation.zip

More information

Add in a new balloon sprite, and a suitable stage backdrop.

Add in a new balloon sprite, and a suitable stage backdrop. Balloons Introduction You are going to make a balloon-popping game! Step 1: Animating a balloon Activity Checklist Start a new Scratch project, and delete the cat sprite so that your project is empty.

More information

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists COMP-202B, Winter 2009, All Sections Due: Tuesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise

More information

CS 2110 Assignment 8: Planet X

CS 2110 Assignment 8: Planet X CS 2110 Assignment 8: Planet X Your CS2110 TAs Due date: See the CMS 1 Introduction We have received a distress call from a spaceship (the USS Java) that just crash-landed on an unknown planet somewhere

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

CS201 - Assignment 7 Due: Wednesday April 16, at the beginning of class

CS201 - Assignment 7 Due: Wednesday April 16, at the beginning of class CS201 - Assignment 7 Due: Wednesday April 16, at the beginning of class http://xkcd.com/205/ For this assignment, we re going to be playing a bit with stacks and queues. Make sure you read through the

More information

CSE 331 Software Design & Implementation

CSE 331 Software Design & Implementation CSE 331 Software Design & Implementation Hal Perkins Spring 2017 GUI Event-Driven Programming 1 The plan User events and callbacks Event objects Event listeners Registering listeners to handle events Anonymous

More information

CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings.

CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings. CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please stop promptly

More information

CSCI 136: Fundamentals of Computer Science II. Keith Vertanen Museum

CSCI 136: Fundamentals of Computer Science II. Keith Vertanen Museum CSCI 136: Fundamentals of Computer Science II Keith Vertanen Museum 102 496-4385 kvertanen@mtech.edu http://katie.mtech.edu/classes/csci136 CSCI 136: Fundamentals of Computer Science II Keith Vertanen

More information

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto Recommed Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto DISCLAIMER: The information contained in this document does NOT contain

More information

Midterm II CS164, Spring 2006

Midterm II CS164, Spring 2006 Midterm II CS164, Spring 2006 April 11, 2006 Please read all instructions (including these) carefully. Write your name, login, SID, and circle the section time. There are 10 pages in this exam and 4 questions,

More information

ECE Object-Oriented Programming using C++ and Java

ECE Object-Oriented Programming using C++ and Java 1 ECE 30862 - Object-Oriented Programming using C++ and Java Instructor Information Name: Sam Midkiff Website: https://engineering.purdue.edu/~smidkiff Office: EE 310 Office hours: Tuesday, 2:30 to 4:00

More information

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit. Com S 227 Spring 2018 Miniassignment 1 40 points Due Date: Thursday, March 8, 11:59 pm (midnight) Late deadline (25% penalty): Friday, March 9, 11:59 pm General information This assignment is to be done

More information

CSE 332 Winter 2015: Final Exam (closed book, closed notes, no calculators)

CSE 332 Winter 2015: Final Exam (closed book, closed notes, no calculators) Email address (UWNetID): CSE 332 Winter 2015: Final Exam (closed book, closed notes, no calculators) Instructions: Read the directions for each question carefully before answering. We may give partial

More information

Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017

Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017 Due: Wednesday, October 18, 11:59 pm Collaboration Policy: Level 1 Group Policy: Pair-Optional Lab 4: Super Sudoku Solver CSCI 2101 Fall 2017 In this week s lab, you will write a program that can solve

More information

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently. The Science of Computing I Lesson 4: Introduction to Data Structures Living with Cyber Pillar: Data Structures The need for data structures The algorithms we design to solve problems rarely do so without

More information

CIS 121 Data Structures and Algorithms with Java Spring 2018

CIS 121 Data Structures and Algorithms with Java Spring 2018 CIS 121 Data Structures and Algorithms with Java Spring 2018 Homework 6 Compression Due: Monday, March 12, 11:59pm online 2 Required Problems (45 points), Qualitative Questions (10 points), and Style and

More information

Lecture 24 Search in Graphs

Lecture 24 Search in Graphs Lecture 24 Search in Graphs 15-122: Principles of Imperative Computation (Fall 2018) Frank Pfenning, André Platzer, Rob Simmons, Penny Anderson, Iliano Cervesato In this lecture, we will discuss the question

More information

Formatting: Cleaning Up Data

Formatting: Cleaning Up Data Formatting: Cleaning Up Data Hello and welcome to our lesson on cleaning up data, which is one of the final ones in this Formatting Module. What we re going to be doing in this lesson is using some of

More information

THREADS & CONCURRENCY

THREADS & CONCURRENCY 27/04/2018 Sorry for the delay in getting slides for today 2 Another reason for the delay: Yesterday: 63 posts on the course Piazza yesterday. A7: If you received 100 for correctness (perhaps minus a late

More information

Word Processing Basics Using Microsoft Word

Word Processing Basics Using Microsoft Word Word Processing Basics Using Microsoft Word lab 3 Objectives: Upon successful completion of Lab 3, you will be able to Use Word to create a simple word processing document Understand the concept of word

More information

n! = 1 * 2 * 3 * 4 * * (n-1) * n

n! = 1 * 2 * 3 * 4 * * (n-1) * n The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion Objectives By completing this lab exercise, you should learn to Recognize simple self-similar problems which are

More information