Skip to content

jnicho02/alexa-fizzbuzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alexa Fizz Buzz

A simple Amazon Alexa number game. This is a demonstration of using Amazon's Alexa Skills Kit SDK for nodejs.

Launch

"Alexa, open Fizz Buzz"

or

"Alex, play Fizz Buzz"

Play

Count upwards from 1 taking turns with Alexa. If a number is divisible by 3 then say, "fizz". If a number is divisible by 5 say, "buzz". And if it is divisible by both 3 and 5 then say, "fizz buzz".

e.g. "1", "2", "fizz", "4", "buzz", etc.

You lose after you get it wrong for the second time.

Installation

Fork this repository to submit pull requests OR use it as a template project for building your own Alexa App. I believe that the easiest way to do this is to use the Serverless Framework.

  1. Get the latest version of Serverless:
npm update -g serverless
  1. Install from the repository:
serverless install -u https://github.com/jnicho02/alexa-fizzbuzz/tree/master -n [your_project_name]
  1. Install npm dependencies:
cd [your_project_name]/lambda/custom
npm

Setup the language model

Alexa language models are set up in their own special web panel. As of 2018, this is being updated constantly so these instructions may have aged.

  1. Open the Alexa Console

  2. Create a new skill

  3. Open your skill

  4. Scroll down and select the 'JSON Editor' in the left-hand menu

  5. Drag and drop /models/en-GB.json (or your language area) to the editor's 'drag and drop a .json file' panel

Deploy from Serverless

sls deploy

Use the AWS Console to see the Lamdba programs created

Monitor

See the inputs and outputs via the Alexa web page

Testing

cd lambda/custom
npm test

Coding style

This is a deliberate model answer for Alexa code to demonstrate best practice.

Module for each request handler

Each RequestHandler will be called by index.handler without knowledge of any other. Keep it neat by putting each into a module and avoid the temptation to create global variables.

Separation of concerns

The workings of the fizzbuzz game itself are in its own module. This allows us to unit test it without invoking any Lamdba, Alexa, etc.

Releases

No releases published

Packages

No packages published