This skill is based on a card game where the player guesses what the next card in the deck is going to be whether it is high or low red or black. It is written in Java script and hosted on Amazon AWS server.
This project was a good opportunity to learn a lot of different things amount how to write an Alexa skill. I utilize an algorithm to randomly shuffle cards so that every game that you play will be unique .
Below is the APL document
"type": "APL",
"version": "1.0",
"theme": "dark",
"import": [
{
"name": "alexa-viewport-profiles",
"version": "1.0.0"
}],
"resources": [],
"styles": {},
"layouts": {},
"mainTemplate": {
"items": [
{
"type": "Container",
"width": "100vw",
"height": "100vh",
"alignItems": "center",
"direction": "column",
"items": [
{
"type":"Frame",
"width": "100vw",
"height": "100vh",
"backgroundColor":"#477148",
"position":"absolute"
},
{
"when": "${@viewportProfile == @hubLandscapeMedium || @viewportProfile == @hubLandscapeLarge ||@viewportProfile==@tvLandscapeXLarge}",
"type": "Text",
"text": "Ride The Bus",
"fontSize":"12vh"
},
{
"when": "${@viewportProfile == @hubRoundSmall}",
"type": "Text",
"paddingTop":"5vh",
"text": "Ride The Bus",
"fontSize":"8vh"
},
{
"type": "Container",
"width": "100vw",
"height": "85vh",
"alignItems": "center",
"direction": "row",
"items": [
{
"when": "${@viewportProfile == @hubLandscapeMedium || @viewportProfile == @hubLandscapeLarge ||@viewportProfile==@tvLandscapeXLarge}",
"type": "Container",
"width": "20vw",
"height": "80vh",
"alignItems": "center",
"direction": "column",
"items": [
{
"type": "Text",
"text": "Card Count"
},
{
"type": "Text",
"text": current
},
{
"type": "Text",
"text": "Your Score"
},
{
"type": "Text",
"text": sesh.score
}
]
},{
"when": "${@viewportProfile == @hubRoundSmall}",
"type": "Container",
"width": "20vw",
"height": "80vh",
"paddingTop":"10vh",
"paddingLeft":"5vw",
"alignItems": "center",
"direction": "column",
"items": [
{
"type": "Text",
"text": "#"
},
{
"type": "Text",
"text": current
},
{
"type": "Text",
"text": "Score",
"fontSize":"5vw"
},
{
"type": "Text",
"text": sesh.score
}
]
},
{
"when": "${@viewportProfile == @hubRoundSmall}",
"type": "Container",
"width": "70vw",
"height": "80vh",
"alignItems": "center",
"direction": "column",
"items": [
{
"type": "Text",
"text": "Current Card"
},
{
"type": "Image",
"source":cpic,
"width": "40vw",
"height": "70vh",
"scale":"best-fit"
}
]
},
{
"when": "${@viewportProfile == @hubLandscapeMedium || @viewportProfile == @hubLandscapeLarge ||@viewportProfile==@tvLandscapeXLarge}",
"type": "Container",
"width": "40vw",
"height": "80vh",
"alignItems": "center",
"direction": "column",
"items": [
{
"type": "Text",
"text": "Current Card"
},
{
"type": "Image",
"source":cpic,
"width": "40vw",
"height": "70vh",
"scale":"best-fit"
}
]
},
{
"when": "${@viewportProfile == @hubLandscapeMedium || @viewportProfile == @hubLandscapeLarge ||@viewportProfile==@tvLandscapeXLarge}",
"type": "Container",
"width": "20vw",
"height": "85vh",
"alignItems": "center",
"direction": "column",
"items": [{
"type": "Container",
"width": "20vw",
"height": "40vh",
"alignItems": "center",
"direction": "column",
"items": [
{
"type": "Text",
"text": "HIGH"
},{
"type": "TouchWrapper",
"item": {
"type": "Image",
"source":"https://s3.amazonaws.com/thebus/up.png",
"width": "20vw",
"height": "30vh",
"scale":"best-fit"
},
"onPress": {
"type": "SendEvent",
"arguments": [
"high"
]
}
}
]
},{
"type": "Container",
"width": "20vw",
"height": "40vh",
"alignItems": "center",
"direction": "column",
"items": [
{
"type": "Text",
"text": "LOW"
},{
"type": "TouchWrapper",
"item": {
"type": "Image",
"source":"https://s3.amazonaws.com/thebus/down.png",
"width": "20vw",
"height": "30vh",
"scale":"best-fit"
},
"onPress": {
"type": "SendEvent",
"arguments": [
"low"
]
}
}
]
}
]
},
{
"when": "${@viewportProfile == @hubLandscapeMedium || @viewportProfile == @hubLandscapeLarge ||@viewportProfile==@tvLandscapeXLarge}",
"type": "Container",
"width": "20vw",
"height": "85vh",
"alignItems": "center",
"direction": "column",
"items": [{
"type": "Container",
"width": "20vw",
"height": "45vh",
"alignItems": "center",
"direction": "column",
"items": [
{
"type": "Text",
"text": "Black"
},{
"type": "TouchWrapper",
"item": {
"type": "Image",
"source":"https://s3.amazonaws.com/thebus/black.png",
"width": "20vw",
"height": "30vh",
"scale":"best-fit"
},
"onPress": {
"type": "SendEvent",
"arguments": [
"Black"
]
}
}
]
},{
"type": "Container",
"width": "20vw",
"height": "45vh",
"alignItems": "center",
"paddingTop":"5vh",
"direction": "column",
"items": [
{
"type": "Text",
"text": "RED"
},
{
"type": "TouchWrapper",
"item": {
"type": "Image",
"source":"https://s3.amazonaws.com/thebus/red.png",
"width": "20vw",
"height": "30vh",
"scale":"best-fit"
},
"onPress": {
"type": "SendEvent",
"arguments": [
"Red"
]
}
}
]
}
]
}
]
}
]
}
]
}
}
