Gettysburg College

CS 111
Computer Science I


ChaosApp

Create a new app called ChaosGameApp that has the procedures described below.

This app consists of two parts:

The overall theme is while loops and creating and updating variables by observing patterns in the computational process.

Canvas Functionality

Touch Interaction

Here is how to wait until the player touches the screen and how to extract the touch coordinates:

Touch touch = canvas.waitForTouch();
double touchX = touch.getX();  
double touchY = touch.getY();  
Note that **touch, touchX, touchY** could be any names of your choice.

Random Integers

Here is how to get a random integer in a given range [a , b]:

int number = canvas.getRandomInt( 10, 20 );  // picks random integer in [10..20] inclusive
Note that **number** could be any name of your choice.

ChaosGameApp: Drawing Portion

The drawing portion has the follwoing procedure:

ChaosGameApp: Math Portion

Here are the procedures for the math portion: