#declare variables
    mathInstructions = '''
    In this game, you will be given a simple arithmetic questions.
    Each correct answer gives you one mark.
    No mark is deducted for wrong answers.'''
    binaryInstructions = '''
    In this game, you will be given a number in base 10.
    Your task is to convert this number to base 2.
    Each correct answer gives you one mark.
    No mark is deducted for wrong answers.'''

    bg = gameclasses.BinaryGame()
    mg = gameclasses.MathGame()

    userName = input('\nPlease enter your username: '******'Welcome %s! Your current score is %d.' %(userName, score))
    
    #use a while loop to run the program until the user chooses to exit
    userChoice = 0

    while userChoice != '-1':
        #prompt the user to select Math game or Binary game
        game = input('\nMath Game (1) or Binary Game (2)?')
        while game != '1' and game != '2':
Exemple #2
0
    """

    binaryInstructions = """
    In this game, you will be given a number in base 10.
    Your task is to conver this number to base 2.
    Each correct answer gives you one mark.
    No mark is deducted for wrong answers.
    """

    newUser = True
    userChoice = 0
    bg = BinaryGame()
    mg = MathGame()

    name = input("Please enter your name: ")
    score = int(getUserScore(name))
    print("Current Score: {0}".format(score))

    if score == -1:
        newUser = True
        score = 0
    else:
        newUser = False

    print("Welcome to the Math Game")

    while userChoice != -1:
        game = int(input("Math Game (1) or Binary Game (2)? "))
        while game != 1 and game != 2:
            game = int(input("Math Game (1) or Binary Game (2)? "))
Exemple #3
0
try:
    # declare variables
    mathInstructions = "In this game, you will be given a simple arithmetic question. Each correct answer gives you one point. Nothing deducted for wrong answers. Best of luck!"
    binaryInstructions = "In this game, you will be given a number in base10." \
                         "Your task is to convert this number to base2 (e.g. 0b1010)." \
                         "Each correct answer gives you one point.\nNothing deducted for wrong answers." \
                         "Best of luck!"


    # instantiate two objects mg and bg
    mg = MathGame()
    bg = BinaryGame()

    userName = input("Enter your username: "******">>" + userName +"<< score >>" + str(score) + "<<")
    if (score == -1):
        newUser = "******"
        score = 0
    else:
        newUser = "******"

    #print("Is new user? " + str(newUser))
    # use a while loop to run the program until the user chooses to exit
    userChoice = 0

    while (userChoice != '-1'):
        # prompt user to select Math game or Binary game
        game = input("Math Game (1) or Binary Game (2), Exit (-1)?\n")
        # prompt user for number of questions per game
from gameclasses import BinaryGame
from gameclasses import MathGame

from gametasks import getUserScore
from gametasks import updateUserScore
from gametasks import printInstructions

try:
    mathInstructions = "In this game, you will be given a simple arithmetic question. Each correct answer gives you one mark. No mark is deducted for wrong answers."
    binaryInstructions = "In this game, you will be given a number in base 10. Your task is to convert this number to base 2. Each correct answer gives you one mark. No mark is deducted for wrong answers."

    bg = BinaryGame()
    mg = MathGame()

    userName = input("Please enter your username: "******"Welcome %s, your score is %d " % (userName, score))

    userChoice = 0

    while userChoice != "-1":
        game = input("MathGame(1) or BinaryGame(2)? ")
        while game != "1" and game != "2":
            game = input("Enter either 1 for MathGame or 2 for BinaryGame: ")
Exemple #5
0
import gametasks as g
# Main  #
userName = ""
score = g.getUserScore("Benny")
print(score)
#updateU = updateUserScore(False, "Darren", "299")
#print('update user {0} \n'.format(updateU))

Exemple #6
0
"""
Created on Wed May 30 15:54:31 2018

@author: tommc
"""

import gametasks
import gameclasses

try:
    mathInstructions = '\nIn this game, you will be given a simple arithmetic question.\nEach correct answer gives you one mark.\nNo mark s deducted for wrong answers.\n'
    binaryInstructions = '\nIn this game, you will be given a number in base 10.\nYour task is to convert this number to base 2.\nEach correct answer gives you one mark.\nNo mark is deducted for wrong answers.\n'
    bg = gameclasses.BinaryGame()
    mg = gameclasses.MathGame()
    userName = input('Please enter your name: ')
    score = gametasks.getUserScore(userName)
    if score == -1:
        newUser = True
        score = 0
    else:
        newUser = False
    print('Welcome {}, you have a score of {}.'.format(userName, score))
    userChoice = 0
    while userChoice != '-1':
        game = 0
        while game == 0:
            try:
                game = int(input('Math Game (1) or Binary Game (2)?: '))
                if game != 1 and game != 2:
                    game = 0
                    print('Please enter 1 or 2')
Exemple #7
0
try:
    mathInstructions = '''\nIn this game, you will be given a simple arithmetic question.
  Each correct answer gives you one mark.
  No mark is deducted for wrong answer\n'''

    binaryInstructions = '''\nIn this game, you will be given a number in base 10.
  Your task is to convert this number to base 2.
  Each correct answer gives you one mark.
  No mark is deducted for wrong answers\n'''

    #Setting game and user
    bg = BinaryGame(4)
    mg = MathGame(4)

    userName = input('Please enter your name: ')
    curScore = getUserScore(userName)
    newUser = False if curScore != -1 else True

    if newUser == True:
        updateUserScore(newUser, userName)
        curScore = 0

    print('\nWelcome %s, your current score is %d' % (userName, curScore))

    #Main game while loop
    userChoice = 0
    while userChoice != '-1':

        #Select game
        game = input('\nMath Game (1) or Binary Game (2): ')
        while game != '1' and game != '2':