SC‐2024‐04‐29‐Afternoon - TheEvergreenStateCollege/upper-division-cs-23-24 GitHub Wiki

Software Construction, Spring 2024

Week 05 Afternoon

First Hour

We will build on our city addresser from the morning by implementing both an Olympia-style and a Tokyo-style addressing scheme. This will allow our city planner, when designing a new city anywhere in the world, choosing which scheme to use at the planning stage.

You can continue working on your assignments/{username}/city-draw directory from last time, or start a new one with a partner if you don't have one.

You may copy over this starter example from this morning (committed and saved thanks to @MrTimmyJ)

Starter City Addresser

Create a New Addresser Function

Allow us to pass an addressing function to city_drawer that has this signature:

`fn city_addresser(x: usize, y: usize

Second Hour

We will start adding the ability to let our tic-tac-toe solvers play against each other by serializing Board's to a String and deserializing from a string (or immutable borrowed reference to one &str) back to a Board.

Copy the prototype-0 directory into an assignments directory named after you and any partners you are working with.

Examine the implementations of the FromStr and Display traits for Board. You may improve these as you see fit.

Run the unit tests

cargo test

Exercise 1:

Add two more unit tests of string representations that demonstrate both valid tic-tac-toe boards that should return an Ok() subtype of Result, and invalid tic-tac-toe boards that should return an Err subtype of Result.

Review this reading from SC Homework 02

Recoverable Errors with Result

Exercise 2: