Version: 5.2.1

## Assignment 1

Goals: Review the design recipes, work with inexact numbers, review the design of loops using the accumulator style.

### 1Instructions

Submit a .zip file that contains two files. A hw1.rkt file and a hw1.txt file.

On top of both files you will have four lines of comments as follows:

 ;; assignment 1 ;; pair xxx ;; partner1-last-name partner1-first-name ;; partner1-username ;; partner2-last-name partner2-firt-name ;; partner2-username

(In the text file you do not need the semi-colons)

The .txt file will be the log of your work on this assignment. Each log entry will have data and time, who was present (one or both of the partners) and a short comment decribing what you were working on.

If you are having problems with your partner, please, email the log to your instructor and request a meeting. We want to make sure that any partnership problems are resolved as soon as possible.

Due Date: Tuesday, January 15 13th, 11:59 pm.

### Problem 1

Finish the problem with the mazes from the lab.

• Design the method longest-path that produces a list of questions and the final reward for the longest path in the maze.

• Design the method flip that produces a new maze where all answers are reversed. So, if before, the answer yes led you to question X, now it will be the answer no that leads you there.

### Problem 2

Design the following methods (continuing the problem that dealt with distances traveled through a list of Posns):

• Design the method total-distance-acc that computes the total distance by accumulating the total distance traveled so far as it traverses over the list of Posns. (This is the method you have started in the lab.)

• Design the method has-loop that produces true if the path traverses through some point more than once (including the final destination).

• Design the method all-visited that produces the list of all Posns along this route, but lists every point only once, even if it is visited more than once.

### Problem 3

Finish the Problem 2 from Section 3 of Lab 1 (the data definitions needed to implement the function computeToll, as well as the function itself.