-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create GuessTheNumber.py #100
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import random | ||
from sugaroid.brain.constants import HOPE_GAME_WAS_GOOD | ||
from sugaroid.brain.postprocessor import random_response | ||
from sugaroid.brain.ooo import Emotion | ||
from sugaroid.core.base_adapters import SugaroidLogicAdapter | ||
from sugaroid.core.statement import SugaroidStatement | ||
|
||
GUESS_NUM_WIN = [ | ||
"Congragulations! You really are a genius.", | ||
"You havae won the game by Guessing the Number correctly.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is a typo.. please change |
||
"Let the celebrations begin!", | ||
] | ||
|
||
GUESS_NUM_LOS = [ | ||
"That was close.", | ||
"Better Luck Next Time Mate.", | ||
"Be enthusiastic and give it a try once more!', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kindly close the statement with the same double quote you've used at the start.. |
||
] | ||
|
||
GUESS_NUM_EMOJI = [ | ||
"🤍", | ||
"💜", | ||
"💙", | ||
"💚", | ||
"💛", | ||
"🧡", | ||
"🤎", | ||
"🖤", | ||
"❤️", | ||
] | ||
|
||
class GUESS_GAME: | ||
def __init__(self,chatbot): | ||
""" | ||
Initiate the guess the number game. | ||
:param chatbot: a chatterbot.chatbot instance | ||
""" | ||
self.num = random.randint(1,100) | ||
self.chatbot = chatbot | ||
self.chatbot.globals["guessthenumber"]["enabled"] = True | ||
self.life = 9 | ||
|
||
def remaining_life(self): | ||
return self.life | ||
|
||
def game(self,statement): | ||
if self.life == 0: | ||
return self.game_over() | ||
|
||
processed = str(statement).strip() | ||
if processsed == "": | ||
return "Please enter a number for me to check it!" | ||
if processed.isspace(): | ||
return "You should enter for me to check it!" | ||
if process.isalpha(): | ||
return "There are no aplhabets in the number. Please enter a nuumber!" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace |
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo again
Congratulations