# Project 3 BYOW

[Prerequisites](https://tomthestrom.gitbook.io/cs61b-fall-2022/prerequisites-to-running-the-assignments.) to running the code.

Instructions: <https://fa22.datastructur.es/materials/proj/proj3/>

Solution (Phase 1): <https://github.com/tomthestrom/cs61b/tree/master/proj3>

The project was divided into 2 phases:

* [Phase 1: World Generation](https://tomthestrom.gitbook.io/cs61b-fall-2022/project-3-byow/phase-1-world-generation)
* Phase 2: Interactivity

## Overview&#x20;

Your task for the next few weeks is to design and implement a 2D tile-based world exploration engine. By “tile-based”, we mean the worlds you generate will consist of a 2D grid of tiles. By “world exploration engine” we mean that your software will build a world, which the user will be able to explore by walking around and interacting with objects in that world. Your world will have an overhead perspective.&#x20;

### Skeleton Code Structure

As always, use `git pull skeleton main` to pull the skeleton code. The skeleton code contains two key packages that you’ll be using: `byow.TileEngine` and `byow.Core`. `byow.TileEngine` provides some basic methods for rendering, as well as basic code structure for tiles, and contains:

* `TERenderer.java` - contains rendering-related methods.
* `TETile.java` - the type used for representing tiles in the world.
* `Tileset.java` - a library of provided tiles.

**IMPORTANT NOTE: Do NOT change TETile.java’s `character` field or `character()` method as it may lead to bad autograder results.**

The other package `byow.Core` contains everything unrelated to tiles. We recommend that you put all of your code for this project in the `byow.Core` package, though this not required. The `byow.Core` package comes with the following classes:

* `RandomUtils.java` - Handy utility methods for doing randomness related things.
* `Main.java` - How the user starts the entire system. Reads command line arguments and calls the appropriate function in `Engine.java`.
* `Engine.java` - Contains the two methods that allow interacting with your system.

`byow.Core.Engine` provides two methods for interacting with your system. The first is `public TETile[][] interactWithInputString(String input)`. This method takes as input a series of keyboard inputs, and returns a 2D `TETile` array representing the state of the universe after processing all the key presses provided in input (described below). The second is `public void interactWithKeyboard()`. This method takes input from the keyboard, and draws the result of each keypress to the screen. Lab 11 covers how to render tiles, and Lab 12 covers how to get user input.

This project makes heavy use of `StdDraw`, which is a package that has basic graphics rendering capabilities. Additionally, it supports user interaction with keyboard and mouse clicks. You will likely need to consult the API specification for `StdDraw` at some points in the project, which can be found [here](https://introcs.cs.princeton.edu/java/stdlib/javadoc/StdDraw.html).

Your project should only use standard java libraries (imported from java.\*) or any libraries we provided with your repo. Your final submission for the Phase 2 Autograder and Checkoff should not use any external libraries other than the ones provided in the skeleton.

**IMPORTANT NOTE: Do NOT use static variables unless they have the final keyword! In 2018, many students ran into major debugging issues by trying to use static variables. Static non-final variables add a huge amount of complexity to a system. Additionally, do not call `System.exit()` in `interactWithInputString` as this will cause the autograder to exit and fail.**
