Computer Science I – Fall 2010 Programming Assignment #7 Goals • For this assignment, I must see the necessary constructs that have been taught are used such as: • Everything from chapter 1-6 (procedural decomposition, variables, datatypes, etc, no magic numbers, good naming, loops, scoping, parameters, return values, using objects, fencepost loops, cumulative sum/product or min/max loops, roundoff errors, if/else statements/nested if/else statements, printf/format), Java doc with pre and post conditions where needed, while/do-while loops, Random objects, boolean operations, assertions (if applicable), File I/O, Try/catch blocks, line and token processing. Robust programs! • Arrays… • Reference semantics Four Choices 1. Book Project #3, page 499 (Mastermind). Two ways to do this: a. Book way: 4 digit number randomly generated (0000-9999) – user gets as many guesses as needed b. Bagels implementation from CS 142, Summer 2009 http://www.cs.washington.edu/education/courses/142/09su/homew ork/6/spec.pdf (example output in “homework 6 of this page http://www.cs.washington.edu/education/courses/142/09su/homew ork.shtml ) c. Standard Mastermind (i.e. 4 slots, 6 colors, no duplicates) drawn in the DrawingPanel. The user gets at most 10 guesses. Show the number correct in the correct position, and the number correct but in the incorrect position. When choosing this option you must specify if you are going to be doing option a) (book) or b) (bagels) or c) (standard). This option uses 1-D arrays. 2. Book Project #4, page 499. Myers Briggs personality test. Also done at UW: http://www.cs.washington.edu/education/courses/142/09au/homework/7/s pec.pdf. The files are linked off here: http://www.cs.washington.edu/education/courses/142/09au/homework.sht ml. Here is an on line similar type test: http://www.humanmetrics.com/cgiwin/JTypes1.htm. However, you don’t actually need the questions for this assignment. You’re given the results – It’s all defined in the book and on the UW assignment. This option uses 1-D arrays. If you’re interested in the Myers briggs test, try the link: http://www.humanmetrics.com/cgi-win/JTypes1.htm. You aren’t programming the test, but you are programming the “analysis engine” to determine individual types. If you’re doing File input/output remember that you can re-use your own code! Cite that you reused it – it will make your programming task easier! 3. Battleship. Have the user guess using the console. Show the results in an ASCII art or DrawingPanel representation of your board. This option uses 2-D arrays. Battleship MAY be done as ASCII art. 4. Game of Life. Evolution of cells, to be shown on the DrawingPanel. You can choose to “read in” the initial state, have the user enter it through the console or randomly generate it. If the user enters it or it’s randomly generated, have the user specify the size of the board. The simulation may be slow, and I won’t count off for that, but do what you can to optimize it. You can choose to run the simulation for ever, run it for a certain number of iterations, or ATTEMPT to figure out if you have a static state system (it’s do-able, but hard). Here’s another description from NYU: http://cs.nyu.edu/courses/fall05/V22.0101-001/hw4.html This option uses 2-D arrays. In fact it may be easiest to use 2 2-D arrays – and then you can swap the references around for each iteration. The suggestion was made to do Game Of Life as ASCII art, however, that would lose a lot of the “simulation”. That would be a good “debugging” mode. Milestones • Milestone 1 – – Due Thursday 12/9 by class time. – BRING YOUR DESIGN TO CLASS. – Specify your Requirements (which project our output is expected) Which option you’re picking, 1, 2, 3, or 4 (and which suboption in the case of #1) • If you’re doing something else you MUST be very detailed and I must approve it • Any assumptions you are making Possibly any drawings you feel like adding to the requirements Detailed Design • pseudo code or diagram that shows functional breakdown Test Plan • List off some of the inputs you will use to test your program and what the expected outputs will be. Design Review will be IN CLASS on Thursday 12/9 Upload design to SOSS after class. . • – – – – – • Milestone 2 – – Due Thursday 12/16 by 5pm through SOSS – .java file containing readable code with comments • Each file/class should contain readable code with comments • Each file/class should have your last name (i.e. BrickerHello.java) • Your .java file should have the appropriate name and header comment • I do NOT want to see .class or .java~ files!!!! – Tell me what (if anything) changed from your requirements/design phase (either in email or a .txt file) • NOTE: there is a problem with sending .zip files through lakeside email! Solution is to change the extension to something else (like .piz). Grading will be based on • Design must be well thought out and understandable • Code MUST be commented and Javadoc must generate • Header at the top of your file have the following: // Your Name // Homework number // Brief description of what assignment you’re doing // Classname (i.e. the name of the class in the file) // Version information // Date • JavaDoc structured comments ABOVE each method. The JavaDoc must generate and have parameters and return values /** * Method description * * @param name description * @param name description * @return description */ • I MUST be able to compile and execute the code you give me. Code that does not compile will be given a 0. • The output you give me must match the requirements you stated in Milestone 1 or you must explain why it was different. • Acceptable projects are graded out of 20 points (0 .. 5 points in each category) based on the following four categories: • Correctness • Design • Style and documentation • Efficiency