Next: , Previous: , Up: Top   [Index]

## Appendix E The Examples

Example 1

I am an example with a caption and a result

Example 1.1

Example 1.2

Multiple lines

Example 1.3

Concatenate strings

Example 2.1

Calculating the number of entities

Example 2.2

Calculating the number of classes

Example 2.3

Ship velocity

Example 2.4

Example 2.5

Stop and teleport spaceship at a random position

Example 2.6

Testing on integer

Example 2.7

Computing the gravity force vector

Example 3.1

Asking the class of an instance

Example 3.2

Aligning a torpedo with its velocity direction

Example 3.3

Rounding numbers, Workspace try out

Example 3.4

Interval loops (for-loop)

Example 3.5

Throwing a die 5 times

Example 3.6

Interval

Example 3.7

Teleport ship

Example 3.8

Integer represented by different bases

Example 3.9

Counting like the ancients

Example 3.10

Shifting bits

Example 3.11

Computer dyscalculia!

Example 3.12

Calculation is correct using rational fractions!

Example 3.13

Twelve apples

Example 3.14

`Torpedo` class with its instance variables

Example 3.15

Method template

Example 3.16

A method returning a constant

Example 3.17

Initialize the space ship

Example 4.1

Dynamic size collection

Example 4.2

Set operations

Example 4.3

Select prime numbers between 1 and 100

Example 4.4

Quantity of prime numbers between 1 and 100

Example 4.5

Collect cubes

Example 4.6

Simple cipher

Example 4.7

A for loop

Example 4.8

A repeat loop

Example 4.9

Collection with a fixed size

Example 4.10

Example 4.11

Collection with a variable size

Example 4.12

Adding, removing element from a dynamic array

Example 4.13

Set collection

Example 4.14

Set, without duplicates

Example 4.15

Convert dynamic array

Example 4.16

Dictionary of colors

Example 4.17

Incomplete game initialization

Example 4.18

Torpedo mechanics

Example 4.19

Space ship mechanics

Example 4.20

Space ship direction method

Example 4.21

Space ship gravity

Example 4.22

Regular refresh of the game play

Example 4.23

Collision between the ships and the Sun

Example 5.1

SpaceWar! key stroke

Example 5.2

Compute divisors

Example 5.3

`teleport:` method

Example 5.4

Implementations of ifTrue:ifFalse:

Example 5.5

Implementing negation

Example 5.6

Ship lost in space

Example 5.7

Initialize `SpaceWar`

Example 5.8

Ship controls

Example 5.9

Firing a torpedo from a space ship in motion

Example 5.10

Collision between the ships and the torpedoes

Example 6.1

Edit the behavior of this morph from its Inspector

Example 6.2

Edit the state of this ellipse from its Inspector

Example 6.3

Complete code to initialize the Spacewar! actors

Example 6.4

Mobile in the game play

Example 6.5

Calculate the gravity force

Example 6.6

`Mobile`’s `update:` method

Example 6.7

Bounds of our Morph objects

Example 6.8

Test when a mobile is “spaced out”

Example 6.9

Initialize overriding in the `Mobile` hierarchy

Example 7.1

Delete all instances of a given morph

Example 7.2

Drawing the clock dial

Example 7.3

We don’t use `VectorGraphics` for performance reason

Example 7.4

Central star extent

Example 7.5

A star with a fluctuating size

Example 7.6

Space ship drawing

Example 7.7

`vertices` an instance variable in `Mobile class`

Example 7.8

Initialize a class

Example 7.9

A class instance variable value is not shared by the subclasses

Example 7.10

`Vertices` a class variable in `Mobile`

Example 7.11

Vertices returned by an instance method

Example 7.12

Collision (accurate) between the ships and the Sun

Example 8.1

Spacewar! keyboard focus effect

Example 8.2

Keystroke to control the first player ship

Example 9.1

Change set contents

Example 10.1

Ensure a FileStream is closed

Example 10.2

Capture thisContext

Example 10.3

Names of Directory Entries

Example 10.4

Halt: Set a Breakpoint

Next: , Previous: , Up: Top   [Index]