CS 1101.py Computer Science I
Spring 2016

Computer Science Department
The Morrissey College of Arts and Sciences
Boston College

About Staff Textbook Grading Schedule Canvas
Piazza Library Resources Labs GitHub Problem Sets
Problem Set 3: Tessellation

Assigned: Saturday February 6, 2016
Due: Thursday February 11, 2016, midnight
Points: 9 up to 12 Points

This is a solo problem set, you are expected to work on your own on this problem set.

Part 1 (6 Points Total)

discount (1 Point)

Write a function discount : int -> float such that a call discount(age) returns a percentage discount depending on the age. Kids (under age 13) get in free (i.e., a 100% discount), people otherwise under the age of 25, but not 19 year olds, receive a 20% discount, seniors >= 65 receive a 30% discount. Otherwise your discount is 0%.

firstFactor (1 Point)

Write a function firstFactor : int -> int such that a call firstFactor(n) returns the smallest integer factor of n that is greater than 1. For example, firstFactor(5) is 5 and firstFactor(323) is 17.

Approximations of Euler's Number (2 Points)

The number e is an important mathematical constant that is the base of the natural logarithm. It is approximately equal to 2.71828, and is the limit of $(1 + 1/n)^n$ as $n$ approaches infinity, an expression that arises in the study of compound interest. It can also be calculated as the sum of the infinite series \[ e = \displaystyle\sum\limits_{n = 0}^{ \infty} \dfrac{1}{n!} = 1 + \frac{1}{1} + \frac{1}{1\cdot 2} + \frac{1}{1\cdot 2\cdot 3} + \cdots \] Write a function euler : int -> float such that a call euler(n) returns the nth approximation of Euler's number. Note that euler(0) should return 1, euler(1) should return 2, and so forth.

isPerfect (2 Points)

An integer n is perfect if it is equal to the sum of its proper factors. For example, 6 is perfect because 6 = 3 + 2 + 1 and 28 is perfect because 28 = 14 + 7 + 4 + 2 + 1. Write a function isPerfect : int -> bool such that a call isPerfect(n) returns True if n is a perfect number and False otherwise.

Part 2 Tessellation (3 Points up to 6 Points)

According to the OED, the word tessellate means To make into a mosaic; to form a mosaic upon, adorn with mosaics; to construct (esp. a pavement) by combining variously coloured blocks so as to form a pattern..

Tessellation was raised to a high art in Persian and Islamic architecture which featured spectacular tessellated structures.

Hafez Tomb Isfahan Alhambra

The 16/17th century German mathematician and astronomer (and astrologer) Johannes Kepler studied tessellation. In 1619 he published Harmonices Mundi (The Harmony of the World) which investigated the mathematical properties of semi-regular (or so-called Archimedian) tessellations. The mathematical properties of tilings remains an active field of study today. See here, here and here.

The stunning tilings at Alhambra date from the 12th century. Some are shown below.

Alhambra 1 Alhambra 2 Alhambra 3
Alhambra 4 Alhambra 5

MC Escher

The Alhambra examples are notable because of the complex interplay between foreground and background. This proved to be especially interesting to the 20th century Dutch artist MC Escher whose famous work was largely inspired by a 1922 visit to Alhambra.
Bird Fish MC Escher Sky and Water I
See also Escher Tessellations.

Your Part

We have posted a simple tessellation with squares.
Square Tiling
In this part of the problem set you are required to implement ONE tessellation of the graphics window. The simplest problem is part A below. Choose part B for 3 points extra credit. Choose Parts C or D for up to 6 points extra credit. Also, see the CS1101 Tessellation Contest below.

Ring Tiling Hexagon Hexagonal Tiling

Part A (3 Points) Ring Tessellation

Write a function ringTessellation : Picture * int -> void such that given a call ringTessellation(picture, n), adds n2 rings to Picture as shown in Figure Ring Tiling above. Each ring should have the same radius but both the width and the color of the ring should be random. Feel free to use your code for ring and rowOfRings from problem set 2.

Part B (6 Points) Hex Tessellation

A regular hexagon is a 6-sided figure with all sides of equal length and all interior angles equal (120 degrees). Like an equilateral triangle, a square and a regular pentagon, a regular hexagon is a regular polygon.

Write a function hexTessellation : Picture * int -> void such that given the call hexTessellation(picture, size), the hexTessellation function adds n2 hexagonal tiles with randomly colored regular hexagons where each side is of length size.

In order to solve this problem, you'll probably want to create a helper function that draws a regular hexagon as shown in Figure Hexagon above.

Part C: (Up to 6 Points) Convex Pentagonal Tiling

Convex pentagons can be used to make especially beautiful tilings.

See this article for the details. Recently, a new pentagon shape was discovered that can be used in tiling.

See the above article for details.

Part D: (Up to 6 Points) Roll Your Own

Choose your own tessellation for up to 6 points extra credit. Better yet, enter the CS1101 Tessellation Contest below! Some possible tiles include:

Greek Cross Golden Ratio TriHexagonal
Elongated Snub Weave

CS1101 Spring Tessellation Contest

If you find tessellation interesting and would like to try your hand at making a beautiful and interesting tiling, have at it! The most interesting tessellation submitted by Thursday March 31, midnight, will receive a prize and one bump of their final letter grade. This means that a C+ would move to a B-, a B would move to a B+ and so forth.

Tessellation submissions will be presented in class and voted on by members of the class. In the case of a tie, the course staff will break the tie.

Submissions

Fall 2014

1 2 3

4 5 6

7 8

Fall 2013

1 2 3

4 5 6

7 8 9

Created on 01-19-2016 23:10.