Code not for production stage (refactoring required) :-) Just attempt to show basic interaction with Alexa
Accounting for playing time for each player
Each player is named color (up to 8 players). The task of the skill is to take into account how much time the players have spent in total on their moves.
Prepare state (saved in handlerInput.attributesManager.getSessionAttributes()
)
side | intent | slots | description |
---|---|---|---|
user > | ClockLaunch | Launch game clock | |
< alexa | ask amount of players, max = 8 | ||
user > | {playersAmount} | tell players amount | |
< alexa | ask color for each player | ||
user > | {playerColor} | tell gemer's color | |
< ... | |||
... > | |||
< alexa | ok, start the game |
side | intent | slots | description |
---|---|---|---|
user > | PlayerSwitch | trannsition to another player | |
< alexa | 'plays {playerColor}' | ||
... > | |||
< ... | |||
... > | |||
user > | PlayersPause | {playerColor} from state | pause game time counter for this player step |
< alexa | ok, ask me to continue when will be ready | ||
user > | PlayerContinue | {playerColor} from state | resume game time counter for this player step |
< alexa | {playerColor} continue the game | ||
< ... | |||
... > | |||
user > | PlayerFinish | player finish game | |
< alexa | 'congragulation player {playerColor}, next player' | ||
... > | |||
< ... | |||
user > | PlayerFinish | {playerColor} | when last player finish game |
< alexa | ok, total time {totalTime}, players time is ... (ASC) | ||
< alexa | repeat results? restart game? exit? |
side | intent | slots | description |
---|---|---|---|
user > | Result | get stats | |
user > | Relaunch | start new game | |
user > | AMAZON.StopIntent | close skill | |
< alexa | bye, see you next time |
- Open your Alexa Developer Console
- Choose JSON Editor (look up in sidebar) > copy content of interactionModel.json and paste it here > Save Model > Build Model
- Endpoint > check AWS Lambda ARN > save
- Choose Code tab (in top bar) > copy contents of lambda/ directory to Skill Code/lambda > Save > Deploy
- Open Test tab > test interaction (you can find neccessary phrases for each intent in interactionModel.json samples)