Class Game

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----Game

public class Game
extends Applet
This class produces the color matching game applet.


Variable Index

 o butSTART
 o buttonBar
color space selector
 o buttons
array of buttons
 o component0
updatable component
 o component1
updatable component
 o component2
updatable component
 o hsvCoord
peer of rgbLocal.
 o random
randomizer
 o rgbLocal
current color
 o rgbTarget
target color (color being matched)
 o spaceID
current color space code
 o updatableComponents
vector of updatable components
 o xyz
peer of rgbLocal.
 o yiqCoord
peer of rgbLocal.

Constructor Index

 o Game()

Method Index

 o informOthers(int)
Tells other components to update themselves.
 o init()
Initializes the applet.
 o randomColor()
Generates random color, avoiding really dark ones that are hard to match by eye.
 o randomColor(RGBCoord)
Generates random color, avoiding really dark ones that are hard to match by eye.
 o recomputeCoordinates()
Recomputes color coordinates.
 o registerComponent(UpdatableComponentImpl)
Registers a component as updatable.
 o reset()
Resets all the components.

Variables

 o spaceID
 int spaceID
current color space code

 o rgbTarget
 RGBCoord rgbTarget
target color (color being matched)

 o rgbLocal
 RGBCoord rgbLocal
current color

 o hsvCoord
 HSVCoord hsvCoord
peer of rgbLocal.

 o yiqCoord
 YIQCoord yiqCoord
peer of rgbLocal.

 o xyz
 XYZSet xyz
peer of rgbLocal.

 o updatableComponents
 protected Vector updatableComponents
vector of updatable components

 o random
 Random random
randomizer

 o component0
 PlaneMatchAndStart component0
updatable component

 o component1
 ProgressText component1
updatable component

 o component2
 SlidersContainer component2
updatable component

 o buttonBar
 ButtonBar buttonBar
color space selector

 o buttons
 Button buttons[]
array of buttons

 o butSTART
 Button butSTART

Constructors

 o Game
 public Game()

Methods

 o init
 public void init()
Initializes the applet.

Overrides:
init in class Applet
 o registerComponent
 protected void registerComponent(UpdatableComponentImpl comp)
Registers a component as updatable.

Parameters:
comp - updatable component to be registered.
 o informOthers
 void informOthers(int from_id)
Tells other components to update themselves.

Parameters:
from_id - ID of the calling component.
 o reset
 public void reset()
Resets all the components.

 o recomputeCoordinates
 protected void recomputeCoordinates()
Recomputes color coordinates.

 o randomColor
 protected int randomColor()
Generates random color, avoiding really dark ones that are hard to match by eye.

 o randomColor
 protected int randomColor(RGBCoord rgbc)
Generates random color, avoiding really dark ones that are hard to match by eye.

Parameters:
rgbc - generated color goes here.