# Pathway W2000s Exercises

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

## W2031 Designing a Floating Point Type

Exercises
• Design a struct named Real whose member properties may only be of type Int or Bool.
• Define initializers:
• `init(_ d:Double)`
• `init(_ n:Int)`
• Define functions for addition, subtraction, multiplication, and division.
• All such functions should take the form: `func operationName(_ other:Real) -> Real`
• These functions should be named add, subtract, multiply, and divide

## W2222 Recursion

Exercises
•  M2222-10  Complete  Merlin Mission Manager  Mission M2222-10.

## W2225 Merge Sort

Exercises
•  M2225-10  Complete  Merlin Mission Manager  Mission M2225-10.

## W2232 Big-O Notation

Exercises

Write an essay (minimum 500 words) which:

• Defines Big-O
• Compares and contrasts Big-O for:
• Bubble-Sort
• Selection Sort
• Insertion Sort
• Merge Sort
• Based upon the above, which sort is most time-efficient for the average case?

## W2261 Paths

Exercises

Making use of your accumulated knowledge to date (both coding and graphics) and using only path primitives:

1. Create a skyline (just an outline, no fill)
1. You must include at least seven buildings
2. At least two of the building must have a domed top
3. You must have at least one arched bridge between buildings

Getting started:

john-williams@codermerlin:~/Projects\$ git clone https://github.com/TheCoderMerlin/IgisShellD W2261

To compile:

john-williams@codermerlin:~/Projects/W2261\$ ./make.sh

To execute:

john-williams@codermerlin:~/Projects/W2261\$ ./run.sh

Your associated url will be: http://www.codermerlin.com/users/john-williams/dyn/index.html

## W2262 Filled Paths

Exercises
• Create a new project, W2262, using W2261 as a starting point.
• Fill the background (sky) with a blue color.
• Fill all other objects with various, solid colors. You must use a total of at least eight different colors (excluding black and white).

Getting started:

john-williams@codermerlin:~/Projects\$ git clone https://github.com/TheCoderMerlin/IgisShellD W2262

john-williams@codermerlin:~/Projects\$ cd W2262/Sources/IgisShellD

john-williams@codermerlin:~/Projects\$ cp ../../../W2261/Sources/IgisShellD/main.swift .

To compile:

john-williams@codermerlin:~/Projects/W2262\$ ./make.sh

To execute:

john-williams@codermerlin:~/Projects/W2262\$ ./run.sh

Your associated url will be: http://www.codermerlin.com/users/john-williams/dyn/index.html

Exercises
• Create a new project, W2263, using W2262 as a starting point.
• Fill the background (sky) with a gradient.
• Fill all other objects with various, gradient colors. You must use a total of at least eight different colors (excluding black and white) and at least four different gradients.
• Add an animated sun which rises in an arc above the eastern horizon in the morning and sets below the western horizon in the evening, moving across nearly the entire canvas. The sun must initially appear in reddish hues, becoming a bright yellow at its zenith, and again in reddish hues as it sets. The change must be gradual throughout the "day".
• BONUS: Alter the color of the buildings in accordance with the time of day

Getting started:

john-williams@codermerlin:~/Projects\$ git clone https://github.com/TheCoderMerlin/IgisShellD W2263

john-williams@codermerlin:~/Projects\$ cd W2263/Sources/IgisShellD

john-williams@codermerlin:~/Projects\$ cp ../../../W2262/Sources/IgisShellD/main.swift .

To compile:

john-williams@codermerlin:~/Projects/W2263\$ ./make.sh

To execute:

john-williams@codermerlin:~/Projects/W2263\$ ./run.sh

Your associated url will be: http://www.codermerlin.com/users/john-williams/dyn/index.html

## W2511 Emergence & Lindenmayer Systems (Part 1)

Exercises

Continuing with this project:

1. Validate your class' functionality by manually testing each of the aforementioned constraints on input.
2. Validate your class' functionality by testing against the following LSystems:

## W2601 Debugging First Steps

Exercises
•  J2601  Create a journal and answer all questions in this experience. Be sure to include all sections of the journal, properly formatted.