Xirax
05:42 01-09-2005 First homework assignment
Ilya Raykhel
CS 312 Assignment 1: Algorithms paper

Problem: construct a lightsaber. We all are geeks here, are we not?

Input set: cross-product of lightsaber type, color, type of crystal, availability of components

Output set: all functional and non-functional lightsabers

Sample algorithm domain:
Lightsaber type: single-bladed, double-bladed
Color: red, purple, blue, green, yellow, silver
Crystal: Bondar, Damind, Sigil, Adegan
Availability of components: some, many, abundant

So, problem data is a set: {type, color, crystal, availability}. Solution is a working lightsaber of specified color.

Algorithm range: single- and double-bladed lightsabers of various colors and properties

Instance: we will be building a double-bladed red lightsaber using a Sigil crystal. That's because Darth Maul is cool. We are located on a high-tech Coruscant where components are freely available.

Size of instance: can't be measured directly, however some crystals are rarer than the others, it's harder to construct a double-bladed saber, and if there are no components you won't get anywhere. We can make some formula based on this information.

Computational device: a particular geek thinking himself a Jedi (Sith?).

Procedure: OK, here I am trodding unknown lands. Lucas keeps this stuff classified so he can earn some more money.
Assumptions: you got the crystal and the components (light fixture, handle, grip, lens, emitter, battery, various holders)
1.Open the handle using a screwdriver. Don't lose the screws.
2.Put the battery at the middle of a handle into its holder.
3.Put the Sigil crystal in front of the battery into its holder. Connect the battery with the crystal's holder.
4.Put the red light fixture around the Sigil crystal.
5.Put one emitter on each side of the handle close to the center. Connect both emitters to the battery.
6.Put one set of lens on each side of the handle close to its sides.
7.Check that every component is well-centered around the axis. Insert the round red button into specified hole on the handle so, when pushed, it would turn on the battery.
8.Close the handle using the screwdriver.
9.Push the button. If the saber has blown up or you've just killed yourself, try again.
10. When it's finely working, put the grip around the handle. It should fit your hands well.

Limitations: well, you will only be able to turn both blades on and off at once. You won't be able to use this lightsaber as a single-bladed one.

The algorithm's implementation is strictly sequential, so there is no “elementary operation” to speak of.
Комментарии:
Centaur
09:32 01-09-2005
Ни фига не sequential. Там между 1 и 9 где-то цикл и, возможно, exception handling.