diff --git a/core/data/en/entities/handsigns.json b/core/data/en/entities/handsigns.json index eb578963..7c6989eb 100644 --- a/core/data/en/entities/handsigns.json +++ b/core/data/en/entities/handsigns.json @@ -1,28 +1,13 @@ { "options": { - "rock": { - "synonyms": ["rock", "stone"], - "data": { - "value": [ - "ROCK" - ] - } + "ROCK": { + "synonyms": ["rock", "stone"] }, - "paper": { - "synonyms": ["paper"], - "data": { - "value": [ - "PAPER" - ] - } + "PAPER": { + "synonyms": ["paper"] }, - "scissors": { - "synonyms": ["scissors"], - "data": { - "value": [ - "SCISSORS" - ] - } + "SCISSORS": { + "synonyms": ["scissors"] } } } diff --git a/core/data/en/entities/levels.json b/core/data/en/entities/levels.json index a3ec176a..1ddce34b 100644 --- a/core/data/en/entities/levels.json +++ b/core/data/en/entities/levels.json @@ -1,28 +1,13 @@ { "options": { - "low": { - "synonyms": ["low"], - "data": { - "value": [ - "LOW" - ] - } + "LOW": { + "synonyms": ["low"] }, - "medium": { - "synonyms": ["medium"], - "data": { - "value": [ - "MEDIUM" - ] - } + "MEDIUM": { + "synonyms": ["medium"] }, - "high": { - "synonyms": ["high"], - "data": { - "value": [ - "HIGH" - ] - } + "HIGH": { + "synonyms": ["high"] } } } diff --git a/skills/games/rochambeau/nlu/en.json b/skills/games/rochambeau/nlu/en.json index 0a90f241..0849f65f 100644 --- a/skills/games/rochambeau/nlu/en.json +++ b/skills/games/rochambeau/nlu/en.json @@ -62,8 +62,15 @@ "equal": [ "No point." ], - "point": [ - "The %handsign_1% beats the %handsign_2%." + "point_for_leon": [ + "I got you. The %handsign_1% beats the %handsign_2%.", + "Yeaaah! The %handsign_1% beats the %handsign_2%.", + "Gotcha! The %handsign_1% beats the %handsign_2%." + ], + "point_for_player": [ + "You got me. The %handsign_1% beats the %handsign_2%.", + "Aargh no. The %handsign_1% beats the %handsign_2%.", + "Well play! The %handsign_1% beats the %handsign_2%." ], "win": [ "I won! Would you like a rematch?" diff --git a/skills/games/rochambeau/src/actions/play.py b/skills/games/rochambeau/src/actions/play.py index f1160680..4743b595 100644 --- a/skills/games/rochambeau/src/actions/play.py +++ b/skills/games/rochambeau/src/actions/play.py @@ -9,44 +9,52 @@ def play(params): handsigns = { 'ROCK': { - 'superior_to': 'scissors', - 'inferior_to': 'paper' + 'superior_to': 'SCISSORS', + 'inferior_to': 'PAPER' }, 'PAPER': { - 'superior_to': 'rock', - 'inferior_to': 'scissors' + 'superior_to': 'ROCK', + 'inferior_to': 'SCISSORS' }, 'SCISSORS': { - 'superior_to': 'paper', - 'inferior_to': 'rock' + 'superior_to': 'PAPER', + 'inferior_to': 'ROCK' } } entities = params['entities'] rounds_nb = 3 # TODO: pickup from memory - player_handsign = None - leon_handsign = random.choice(list(handsigns)) + player = { + 'handsign': None, + 'points': 0 + } + leon = { + 'handsign': random.choice(list(handsigns)), + 'points': 0 + } # Find entities for item in params['entities']: if item['entity'] == 'handsign': - player_handsign = item['resolution']['value'] + player['handsign'] = item['option'] # Return no speech if no number has been found - if player_handsign == None: + if player['handsign'] == None: return utils.output('end', None, None, { 'isInActionLoop': False }) - if leon_handsign == player_handsign: + if leon['handsign'] == player['handsign']: return utils.output('end', 'equal', utils.translate('equal')) # Point for Leon - if handsigns[leon_handsign]['superior_to'] == player_handsign: + if handsigns[leon['handsign']]['superior_to'] == player['handsign']: # TODO: increment +1 for Leon - # TODO: remove print - print('...') + return utils.output('end', 'point_for_leon', utils.translate('point_for_leon', { + 'handsign_1': leon['handsign'].lower(), + 'handsign_2': player['handsign'].lower() + })) # TODO: increment +1 for player - return utils.output('end', 'equal', utils.translate('point', { - 'handsign_1': leon_handsign.lower(), - 'handsign_2': player_handsign.lower() + return utils.output('end', 'point_for_player', utils.translate('point_for_player', { + 'handsign_1': player['handsign'].lower(), + 'handsign_2': leon['handsign'].lower() }))