mirror of
https://github.com/leon-ai/leon.git
synced 2024-11-23 20:12:08 +03:00
fix(skill/rochambeau): final logic
This commit is contained in:
parent
7f5e30ac82
commit
0ebc0518e6
@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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?"
|
||||
|
@ -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()
|
||||
}))
|
||||
|
Loading…
Reference in New Issue
Block a user