Andrea De Gaetano
Published © GPL3+

Euro Soccer!

This skill give informations about European Football Cup 2016: about teams and results.

IntermediateProtipOver 1 day51
Euro Soccer!

Things used in this project


Read more


not a schematic...

Just to pass the validation.
The contest asked for a VUI diagram..I searched on internet and there is no mention about it..Also I have asked on twitter ( @dega1999 ) no responses :)
Ico max


An xml to logically connect:

A file structure I built for my needs.
I feel it is complicated How to connect the piecese of an alexa skill.
This is a logical connection between the intent, utterances and team.
There is a python script that is able to parse this xml and produce a list of utterances.
<!-- Variables are with 2 #, like #field#. It will be replaced by <field> from the tool
     it will also extract ALL the utterance in a SampleUtterance.txt file

the user will be able to ask: match results, the next match of a team, the last result of a team

	<description>No intent.. launch request</description> <!-- *** CHANGE DURING TIME -->
	<utterance>give me some info</utterance>
	<utterance>how to use the skill</utterance>
	<description>Adversary of {Team}</description> <!-- *** CHANGE DURING TIME -->
	<utterance>who are adversary of {Team}</utterance>
	<utterance>who will {Team} encounters</utterance>
	<utterance>who will {Team} play against</utterance>
	<utterance>who will be the opponent of {Team} play against</utterance>
	<description>The group for {Team}</description> <!-- **** -->
	<utterance>which is the group for {Team}</utterance>
	<utterance>in which group is {Team}</utterance>
	<description>Teams in a {Group}</description> <!-- **** -->
	<utterance>which are the teams for {Group}</utterance>
	<utterance>which are the teams for group {Group}</utterance>
	<utterance>teams for {Group}</utterance>
	<utterance>teams for group {Group}</utterance>
	<description>Teams in the cup</description> <!-- **** -->
	<utterance>who are the teams in the cup</utterance>
	<utterance>which are the teams in the cup</utterance>
	<utterance>who are the teams</utterance>
	<utterance>list all the teams</utterance>
	<utterance>which are the teams</utterance>
	<utterance>give me the teams</utterance>
	<utterance>give me the cup teams</utterance>
	<utterance>give me the qualified teams</utterance>
	<description>The groups of the cup</description> <!-- **** -->
	<utterance>which are the groups in the cup</utterance>
	<utterance>which are the groups</utterance>
	<utterance>list the groups in the cup</utterance>
	<utterance>give me the groups</utterance>
	<utterance>list all the groups</utterance>

<!--future release calls:
	- it responds with "Cup is not started yet! You can receive answer by" by default TODO
	- change previous dependency calls
	<description>Players for #Team</description>
	<utterance>EuroCup which are the players of #Team#</utterance>
	<description>When TheTeam Will play</description>--> <!-- *** CHANGE DURING TIME TODO LATER -->
<!--	<intent></intent>
	<utterance>when #Team# will play</utterance>

	<description>About today results</description>
	<utterance>results for today</utterance>
	<utterance>who played today</utterance>
	<description>About today results</description>
	<utterance>results for today</utterance>
	<utterance>matches for today</utterance>
	<utterance>who played today</utterance>
	<description>Last results</description>
	<utterance>last results</utterance>
	<utterance>last matches</utterance>
	<utterance>last played matches</utterance>
	<description>About today results</description>
	<utterance>results for today</utterance>
	<utterance>who played today</utterance>


Utility class used by the skill
'use strict';

var FRA = "France";
var ROM = "Romania";
var ALB = "Albania";
var SWI = "Switzerland";

var ENG = "England";
var RUS = "Russia";
var WAL = "Wales";
var SLO = "Slovakia";

var GER = "Germany";
var UKR = "Ukraine";
var POL = "Poland";
var NIR = "Northern Ireland";

var SPA = "Spain";
var CZR = "Czech Republic";
var TUR = "Turkey";
var CRO = "Croatia";

var BEL = "Belgium";
var ITA = "Italy";
var EIR = "Republic of Ireland";
var SWE = "Sweden";

var POR = "Portugal";
var ICE = "Iceland";
var AUS = "Austria";
var HUN = "Hungary";

//static informations! Enough for phase 1.
var groups = [ 

var matches= [ ["France","Romania","10 Jun"]]; //time missing...

function EuroUtils() {}

EuroUtils.prototype.allGroups = function() {
	var ggroups = [];
	for(var i=0;i<groups.length;i++)
	if( ggroups.length === 0 ) 
		return false;
	return ggroups;

EuroUtils.prototype.formattedOutput = function(tteams) {
	var result = "";
		return "I don't know, sorry.";
	for(var i=0;i<tteams.length;i++) {
		result += tteams[i] + ",";
		return "I don't know, sorry.";
	return result;

//return the group for the team passed... in string, or false.
EuroUtils.prototype.groupForTeam = function(theTeam) {
	for (var i=0;i<groups.length;i++) { // for each group
		if( groups[i][1].indexOf(theTeam) !== -1 ){ //check if the group contains the team
			return groups[i][0];
	return false;

//return the teams found for the group passed.. as an array of string, or false.
EuroUtils.prototype.teamsForGroup = function(groupLetter) {
	var theTeams = false;
	for ( var i=0;i<groups.length;i++ ) { // for each group
		if ( groups[i][0] === groupLetter ) //check if the group contains the team
			theTeams = groups[i][1];
	return theTeams;

//return the adversary of team theTeam, or false if the theTeam is not found.
EuroUtils.prototype.adversariesForTeam = function(theTeam) {
	var groupLetter = this.groupForTeam(theTeam);
	if( groupLetter !== false ) {
		var allTeamsInGroup = this.teamsForGroup(groupLetter);
		if(allTeamsInGroup !==false) {
			var tteams = [];
			for( var i=0;i<allTeamsInGroup.length;i++) {
				if( allTeamsInGroup[i] !== theTeam ) 
			return tteams;
	return false;

//return all the teams of the cup
EuroUtils.prototype.teamsForCup = function() {
	var theTeams = new Array();
	for ( var i=0;i<groups.length;i++ ) { // for each group
		for ( var j=0;j<groups[i][1].length;j++) {
	if ( theTeams.length === 0 )
		return false;
	return theTeams.sort();

module.exports = EuroUtils;

A test class

This class is used to test the "core" of the application.
It was extremely useful for minimize the error once the skill was submitted.
I also used to print all the teams to insert in a special custom slot.
var EuroUtils = require('./EuroUtils');

var euroUtils = new EuroUtils();
console.log("TEST 1: count teams");

var teams = euroUtils.teamsForCup();
if ( teams.length !== 24 ) {
	console.log("The number of teams is not 24!");

console.log("Listing teams...");
for(var i=0;i<teams.length;i++) {
	console.log("" + teams[i]);

console.log("TEST 2: group for team Sweden");
var tempTeam = "Sweden";
var groupForTeam = euroUtils.groupForTeam(tempTeam);
if (groupForTeam !== 'E')
	console.log(""+tempTeam+ " found in wrong group: " + groupForTeam);

console.log("TEST 3: group for unexisting team");
tempTeam = "ABCDE";
var groupForTeam = euroUtils.groupForTeam(tempTeam);
if (groupForTeam !== false)
	console.log("Unexisting team ("+tempTeam+ ") found in a group... " + groupForTeam);

console.log("TEST 4: teams for group B");
var tempGroup = 'B';
var teamsForGroup = euroUtils.teamsForGroup(tempGroup);
var groupB = ["England","Russia","Wales","Slovakia"];

for(var i=0; i < groupB.length ; i++) {
	if(teamsForGroup.indexOf(groupB[i]) === -1) {
		console.log("Team " + groupB[i] + " not found on group B");
		for(var j=0;j<teamsForGroup.length;j++)

console.log("TEST 5: teams for unexisting group");

tempGroup = "ABCDE";
teamsForGroup = euroUtils.teamsForGroup(tempGroup);
if( teamsForGroup !== false) {
	console.log("Teams ("+teamsForGroup.length+") found for unexisting group");

console.log("TEST 6: adversary for team Sweden");
tempTeam = "Sweden";
adversaries = euroUtils.adversariesForTeam(tempTeam);
if( adversaries === false ) {
	console.log("Adversary for " + tempTeam + " not found..");
if(adversaries.length !== 3 ) {
	console.log("Adversary for " + tempTeam + " not 3!");
	for(var i=0;i<adversaries.length;i++)

if( adversaries.indexOf("Belgium") === -1 && 
	adversaries.indexOf("Italy") === -1 && 
	adversaries.indexOf("Republic of Ireland") === -1 ) {
	console.log("One of the adversary of Sweden is missing!");

console.log("TEST 7: adversary for unexisting team");
tempTeam = "ABCDE";
adversaries = euroUtils.adversariesForTeam(tempTeam);
if( adversaries !== false ) {
	console.log("Found adversaries for unexisting team!");

console.log("TEST 8: all groups letter");
var letters = euroUtils.allGroups();

if( letters.length !== 6 ) {
	console.log("Missing some letters..");
	for(var i=0;i<letters.length;i++) 

console.log("TEST 9: Formatted Output");
var lettersFormatted = euroUtils.formattedOutput(euroUtils.allGroups());
if ( "A,B,C,D,E,F," !== lettersFormatted ) {
	console.log("Wrong Output: [" + lettersFormatted + "]");

console.log("TEST 10: Formatted Output empty array");
if ( euroUtils.formattedOutput([]) !== "I don't know, sorry." ) {
	console.log("Error on empty input array");

console.log("ALL TESTS PASSED");

The Code of the skill

All the skill is implemented here in this repository: it obviously miss the key , in the index.js


Andrea De Gaetano

Andrea De Gaetano

8 projects • 14 followers
Interested in iot, mobile and security Love hackathons This is my blog