Dangerous Field for Alexa

Dangerous fieldThe nostalgia of coding and playing Dangerous Field on the calculator inspired me to revive the series with an all new version of the game.  This latest incarnation is implemented as an Alexa Skill for the Amazon Echo.  Although the interface is completely different, I think that it has a certain charm due to the simpleness and silliness.

From a technical perspective, there are two parts:  the voice interface and the game implementation.  Amazon makes the voice “Interaction Model” fairly easy to configure–it least for this simple scenario.  The Intent Schema basically defines a way for users to specify how to move (direction and with an optional  movement type) as well as indicate that they want to play and support some basic Amazon intents.

{
  "intents": [
    {
      "intent": "move",
      "slots": [
        {
          "name": "direction",
          "type": "DIRECTION"
        }
      ]
    },
    {
      "intent": "movewithstyle",
      "slots": [
        {
          "name": "movementtype",
          "type": "MOVEMENT_TYPE"
        },
                {
          "name": "direction",
          "type": "DIRECTION"
        }
      ]
    },
    {
      "intent": "playGame"
    },
    {
      "intent": "AMAZON.NoIntent"
    },
    {
      "intent": "AMAZON.YesIntent"
    },
    {
      "intent": "AMAZON.HelpIntent"
    },
    {
      "intent": "AMAZON.StopIntent"
    },
    {
      "intent": "AMAZON.CancelIntent"
    }
  ]
}

I added two custom slot types to let users specify which direction to go and which movement type to use.

DIRECTION 	NORTH | SOUTH | EAST | WEST 	
MOVEMENT_TYPE 	hop | skip | jump | leap | walk | run | gallop

With that in place, it was easy to provide a handful of sample utterances.

playGame to play
playGame to play game
playGame play
playGame play game
movewithstyle {movementtype} {direction}
move move {direction}
move go {direction}
move travel {direction}
move {direction}

And that is all there is to defining the user interface to parse what the user is doing.  Amazon’s magic converts what the user says into JSON which is passed to the actual game implementation.

I wrote the game portion as a Lambda Function using Java.  I installed the AWS Toolkit into Eclipse and found that made it a lot easier to write code on my computer and then push it up to the cloud.

So, here’s how a basic game goes:

Me:    Alexa, start Dangerous Field.
Alexa: You are standing in a field.  What do you want to do?
Me:    Go east.
Alexa: With a jiffy jog you jump joyfully to the east.
You are standing in a field.  What do you want to do?
Me:    Leap south.
Alexa: South you leap like a lascivious leprechaun launched over the rainbow.  You fall into a hole.  You die.  
You are standing in a field.  What do you want to do?  You failed to escape from the Dangerous Field.

Anyway, click the picture below to go to the Echo page and enable Dangerous Field.
dangerousFieldSkill

Farmer Giles of Ham

Tolkien BooksI have long been familiar with Tolkien’s The Hobbit and also The Lord of the Rings, but remained mostly ignorant of his other works apart from a 1982 print of The Silmarillion which somehow ended up in my collection.  This past Mother’s Day my wife received a couple volumes of other Tolkien tales and I noticed in one that among the “other books by the author” it listed The Adventures of Tom Bombadil and was intrigued enough to order it in a volume combined with Farmer Giles of Ham.

When the book arrived, I took a quick peek and immediately selected Farmer Giles of Ham as the next after dinner read aloud book for the family.  Upon completion, the family unanimously agreed that it is a terrific tale.  I think what made it so great for the entire family is that the writing is very Tolkienish, but it’s an easier read of a fantasy story (perhaps more a fairy tale) as compared to the more well-known stories involving hobbits and elves.

The story certainly contains a sufficient quantity of elements to hold the attention of all ages:  An unexpected hero going on a quest, knights, a magic sword, giants, dragons, battles, and a talking dog named Garm.  There was also the unconventional inclusion of a blunderbuss.  There are no spoilers here, but it can safely be said that the story is both amusing and entertaining.

In true Tolkien fashion, all the key players have clever names; often both a formal “book-Latin” name as well as the common “vulgar” name.  Even the the book title is referred on the title page with the lengthier “The Rise and Wonderful Adventures of Farmer Giles, Lord of Tame, Count of Worminghall and King of the Little Kingdom”.  These names tend to be more pompous and less serious than what I’ve seen in other works by Tolkien.  While the reasoning behind the names is explained when appropriate, the descriptions do not seem to require as many lengthy history lessons or descriptions of lineages as compared with that with which I was previously accustomed.

The writing style is elegant, but also accessible.  Tolkien puts words together in clever combinations that not only tell the story, but also contain wit enough to make reading alone pleasurable even were there no plot.  I did find the tone less formal than is typical.  Also, I think the words used are a little easier–I think I understood all the words and only had trouble pronouncing a few.

While not at the same literary level as The Lord of the Rings, Farmer Giles of Ham is a fun, accessible story.  Many people (especially younger readers) stall when reading Tolkien for the first time due to the immensity of Middle Earth and the history and culture that is described between (and occasionally even during) the action scenes.  For those who have started and failed or those that want a more gentle introduction, at under 80 pages Farmer Giles of Ham may be just the thing.