Skip to content
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

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions sugaroid/brain/GuessTheNumber.py
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.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo again Congratulations

"You havae won the game by Guessing the Number correctly.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a typo.. please change havae to have

"Let the celebrations begin!",
]

GUESS_NUM_LOS = [
"That was close.",
"Better Luck Next Time Mate.",
"Be enthusiastic and give it a try once more!',
Copy link
Member

Choose a reason for hiding this comment

The 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!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace aplhabets with alphabets