On this page:
Instructions
Mastery Check 6:   Homework 5 code walk
1 Problem 1 — Image  File function objects
2 Problem 2 — Fish Feeding Frenzy
Code and submission requirements
Optional extensions
8.13

Assignment 5: Image Files and Fishy🔗

Goals: Practice function objects over lists and design a medium-sized world program.

Instructions🔗

This assignment has two independent submissions:

Mastery Check 6: Homework 5 code walk🔗

Complete and submit both problems with your partner. The ImageFiles submission determines your autograded Homework 5 score. The submitted Fishy program is a course artifact used for Mastery Check 6; it receives no separate line-by-line, style, or extra-feature grade.

The Fishy autograder score out of 10 reports basic submission and execution checks only. It does not contribute to your homework, code-walk, or final grade. The Fishy submission remains required for the separately graded code walk. Passing these checks does not establish that all game requirements are satisfied.

Each pair must make one booking through the Fishy code-walk booking page for one approximately ten-minute appointment block. That page lists the current dates and times. The student who makes the booking must provide both partners’ names and SHU email addresses; if you are working alone, enter solo for the partner information. Both partners must attend. Within the shared appointment, the pair will first open the submitted programs and run one requested example. Then each student will be assessed individually with different prompts: be ready to explain an instructor-selected part of either submitted problem and to trace, diagnose, or make a small change. You may use your submitted code and the tools normally available to you, including AI. During the walk, neither partner may speak to, signal, or assist the other; respond only to the instructor. Tool output by itself is not evidence of your understanding. If one partner is absent, the attending partner can still complete the walk and receive an individual score.

The explanation prompt and the trace, diagnosis, or change prompt are equally weighted. Each receives 2 for satisfactory evidence of the requested skill, 1 for meaningful but incomplete evidence, or 0 for no usable evidence. Together, the two scores determine the separately weighted code-walk grade described in the syllabus. Speaking polish, speed, and a particular program design are not scoring criteria.

Select one of the posted blocks rather than arranging an appointment piecemeal by email. If a documented conflict or approved accommodation makes the published booking options unusable, contact the instructor before the first appointment begins to arrange an equivalent format. An unarranged no-show earns zero for the code walk under the syllabus policy; there is no routine redo or bespoke makeup.

1 Problem 1 — ImageFile function objects🔗

Use the following data and exact interface names:

class ImageFile {
String name;
int width;
int height;
String kind;
 
ImageFile(String name, int width, int height, String kind) { ... }
}
 
interface ISelectImageFile {
boolean apply(ImageFile file);
}
 
interface ILoIF {
boolean contains(ImageFile file);
ILoIF filterImageFile(ISelectImageFile predicate);
boolean allSuchImageFile(ISelectImageFile predicate);
}
 
class MtLoIF implements ILoIF { ... }
class ConsLoIF implements ILoIF { ... }

Complete and thoroughly test all of the following work:

2 Problem 2 — Fish Feeding Frenzy🔗

Design a version of Fishy. The player begins as a small fish among both smaller and larger fish. The player survives by eating smaller fish and avoiding larger ones, and wins after becoming larger than every other fish in the pond.

Your game must:

Code and submission requirements🔗

Name your world class FishyWorld and have it extend javalib.funworld.World. Provide these two constructors:

Both constructors must initialize a complete starting game without opening a window. To play, construct the world and then call bigBang on it, as in the course examples. You may add other constructors as your design requires. The instructor tests will use these constructors and the World library’s scene, tick, and key methods. Design the remaining classes, fields, and helper methods yourself.

Submit all source and required assets, using paths relative to the submission folder. Your program must compile with the supplied course libraries. Put your Java source files, UserGuide.txt, and Design.txt at the top level of the ZIP; assets may be in subfolders. Use the default package, with no package declarations.

Do not make the game elaborate at the expense of its design. Include a short UserGuide.txt explaining how to play and a Design.txt describing the purpose and relationships of the classes.

Optional extensions🔗

Possible extensions include movement inertia, size-dependent acceleration, scoring, size bonuses, and speed bonuses. Any extension must remain well-designed and tested. Optional extensions earn no additional points.