/// Name: Jory Denny /// Section: 00 import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; /// This program will simulate a fish moving around a grid world aquarium. public class aquarium { /// @brief Read the state of the aquarium from a file /// @param inFilename Name of input file /// @return 2D array representing the tank /// /// The file is formatted like: /// /// /// /// Each character is one of '.' (ocean), 'O' (rock), 'F' (fish) public static char[][] ReadTankState(String inFilename) throws FileNotFoundException { char[][] tank = new char[2][2]; return tank; } /// @brief Initialize graphics /// @param N Size of the tank /// /// Set the canvas size. Set the X-scale and Y-scale for the virtual world. /// Enable double buffering for smooth animation public static void InitializeGraphics(int N) { } /// @brief Clear canvas /// /// Clear the canvas to be blue like the ocean public static void Clear() { } /// @brief Draw name and timestep in window /// @param name Your name to draw /// @param t Time step of simulation /// @param N size of tank to position strings appropriately /// /// Draw name at top left corner. Draw time step at bottom right corner. public static void DrawInfo(String name, int t, int N) { } /// @brief Draw grid lines /// @param N size of the tank /// /// Draw grid lines. Recall that the center of each grid cell should be an /// integer value (i, j). Each cell is 1x1 in virtual world units. Thus the /// lines around each cell are a box from (i - 0.5, j - 0.5) to /// (i + 0.5, j + 0.5) public static void DrawGridLines(int N) { } /// @brief Draw tank /// @param tank Aquarium state /// @param dir Direction of fish movement /// @return Integer for the location of the fish /// /// Iterate over the tank. If '.' do nothing. If 'O' draw a circle. If 'F' /// draw the fish. Also at the same time find the location of the fish. public static int DrawTank(char[][] tank) { int fi = -1, fj = -1; return fi*tank.length + fj; } /// @brief Update the fish's position in the tank /// @param tank State of the aquarium /// @param i Fish's current row /// @param j Fish's current column /// /// The fish must move. The fish cannot move into an obstacle. The fish cannot /// move outside of the boundary. public static void MoveFish(char[][] tank, int i, int j) { } /// @brief Show and pause the simulation /// /// Pause for 100ms. public static void ShowAndPause() { } /// @brief Write the state of the aquarium to a file /// @param outFilename Name of output filename /// @param tank 2D array representing the tank /// /// The file is formatted like: /// /// /// /// Each character is one of '.' (ocean), 'O' (rock), 'F' (fish) public static void WriteTankState(String outFilename, char[][] tank) throws FileNotFoundException { } /// @brief Main function will run the overall flow of the program. /// /// - Read input file /// - for 100 timesteps /// - Move fish /// - Draw fish /// - Write output file public static void main(String args[]) throws FileNotFoundException { //read tank from file //Initialize graphics/window //simulate fishy //Clear //Name + iteration //Grid //Draw tank //Update Fish //Show/pause //write tank to file System.exit(0); } }