Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
Java Programming

Tutorial: Quilts - an introduction

 

We can construct immutable Quilts. A quilt is a grid of squares. There are only two squares: b and c. There are two operations turn and sew.

CommandMeaning
Quilt.b
Quilt.c
Quilt.b.turn()
Quilt.b.sew(Quilt.c)

1. Warming up


Big

The default program renders a b quilt.

Use the sew method to produce two b squares:

2. Four bs


Big

Create a row of four b squares.

3. Two stack


Big

Put two bs together, then turn.


4. b square


Big

Use the previous answer and sew it to the same again.


5. Stripes


Big

Turn the c twice to produce thick and thin stripes.