# FUN WITH SHAPES INFORMATION PROCESSING 10 MR. MELLESMOEN.

## Presentation on theme: "FUN WITH SHAPES INFORMATION PROCESSING 10 MR. MELLESMOEN."— Presentation transcript:

FUN WITH SHAPES INFORMATION PROCESSING 10 MR. MELLESMOEN

USING WHAT WEVE LEARNED Were going to have some fun in this chapter with whatever weve learned so far. This lesson contains samples that show some interesting ways of combining all that youve learned so far to create some cool looking programs.

RECTANGLOR! The following program will draw a series of rectangles increasing in size with each loop of the program. GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenColor = "LightBlue" GraphicsWindow.Width = 200 GraphicsWindow.Height = 200 For i = 1 To 100 Step 5 GraphicsWindow.DrawRectangle(100 - i, 100 - i, i * 2, i * 2) EndFor

RESULT… It should look like this:

CIRCTACULAR! A variant of the previous program, draws circles instead of squares. GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.PenColor = "LightGreen" GraphicsWindow.Width = 200 GraphicsWindow.Height = 200 For i = 1 To 100 Step 5 GraphicsWindow.DrawEllipse(100 - i, 100 - i, i * 2, i * 2) EndFor

RANDOMIZE! Im not even going to tell you what this creates, however if entered correctly it should be pretty cool. GraphicsWindow.BackgroundColor = "Black" For i = 1 To 1000 GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() x = Math.GetRandomNumber(640) y = Math.GetRandomNumber(480) GraphicsWindow.FillEllipse(x, y, 10, 10) EndFor

PLAY WITH THE NUMBERS In your randomize program, play with some of the numbers to see what happens.

FRACTALS The program I will hand out draws a simple triangle fractal using random numbers. A fractal is a geometric shape that can be subdivided into parts, each of which resembles the parent shape accurately.

PLAY WITH THIS PROGRAM Insert the following line Program.delay (2) between GraphicsWindow.SetPixel(x, y, "LightGreen") EndFor Program.delay (2)

LAST CHANGE In your program you have the line: GraphicsWindow.SetPixel(x, y, "LightGreen") as your second last line of code. Replace that line with these lines: color = GraphicsWindow.GetRandomColor() GraphicsWindow.SetPixel(x, y, color)

DONE! Make sure you save your work