May 23, 2011

Let's sing a song

Here's an algorithm for a song, released free for use.

Vector<Action> actions = new Vector<Action>();
actions.add( new ClapHandsAction() );
actions.add( new StompFeetAction() );
actions.add( new ShoutAction("Hooray") );
CompositeAction allThree = new CompositeAction();
allThree.add( new ClapHandsAction() );
allThree.add( new StompFeetAction() );
allThree.add( new ShoutAction("Hooray") );
actions.add(allThree)
for(Action a: actions)
{
    if (person.state() == Person.HAPPY &&
    person.knownState() == person.state())
        {
        person.apply(a);
person.face().reflectState(person.state());
        }
}

First thing that comes to my mind is that the above algorithm could be optimised.

Second thing that comes to my mind that if I really spend my evenings doing this, things have gone terribly wrong.

No comments:

Post a Comment