示例#1
0
def index():
    # index_dict used throughout to pass the variables required every time the index page is loaded
    index_dict = {
        'string': '',
        'skipped': '',
        'counter': dbf.get_counter(),
        'current_player': dbf.get_player()[0][1],
        'score_table': dbf.get_scores()
    }
    return template('/home/drewdavie/mysite/index.tpl', **index_dict)
示例#2
0
def new_string():

    # if there is already a current string, prevent the user from getting a new string and append a warning
    if len(dbf.get_current_string()) > 0:
        index_dict = {
            'string': dbf.get_current_string() + '- Solve the current clue!',
            'skipped': dbf.get_skipped_string(),
            'counter': dbf.get_counter(),
            'current_player': dbf.get_player()[0][1],
            'score_table': dbf.get_scores()
        }
        return (template('/home/drewdavie/mysite/index.tpl', **index_dict))

    index_dict = {
        'string': dbf.get_new_string(),
        'skipped': dbf.get_skipped_string(),
        'counter': dbf.get_counter(),
        'current_player': dbf.get_player()[0][1],
        'score_table': dbf.get_scores()
    }
    return (template('/home/drewdavie/mysite/index.tpl', **index_dict))
示例#3
0
def guessed_string():

    # if there isn't a current string then effectively do nothing
    if dbf.get_current_string == '':
        index_dict = {
            'string': '',
            'skipped': dbf.get_skipped_string(),
            'counter': dbf.get_counter(),
            'current_player': dbf.get_player()[0][1],
            'score_table': dbf.get_scores()
        }
        return (template('/home/drewdavie/mysite/index.tpl', **index_dict))

    dbf.set_guessed_string()
    index_dict = {
        'string': '',
        'skipped': dbf.get_skipped_string(),
        'counter': dbf.update_counter(),
        'current_player': dbf.get_player()[0][1],
        'score_table': dbf.get_scores()
    }
    return (template('/home/drewdavie/mysite/index.tpl', **index_dict))
示例#4
0
def skip_string():

    # if there is already a skipped string, prevent the user from skipping again and append a warning
    if len(dbf.get_skipped_string()) > 0:
        index_dict = {
            'string': dbf.get_current_string(),
            'skipped':
            dbf.get_skipped_string() + ' STOP TRYING TO SKIP TWICE.',
            'counter': dbf.get_counter(),
            'current_player': dbf.get_player()[0][1],
            'score_table': dbf.get_scores()
        }
        return (template('/home/drewdavie/mysite/index.tpl', **index_dict))

    dbf.set_skipped_string()
    index_dict = {
        'string': dbf.get_current_string(),
        'skipped': dbf.get_skipped_string(),
        'counter': dbf.get_counter(),
        'current_player': dbf.get_player()[0][1],
        'score_table': dbf.get_scores()
    }
    return (template('/home/drewdavie/mysite/index.tpl', **index_dict))
示例#5
0
def end_turn():

    # at the end of the turn, unset any current or skipped clues, update the player turn count, and reset the counter
    dbf.reset_clues()
    dbf.end_player_turn()
    dbf.reset_counter()
    index_dict = {
        'string': '',
        'skipped': '',
        'counter': '0',
        'current_player': dbf.get_player()[0][1],
        'score_table': dbf.get_scores()
    }
    return (template('/home/drewdavie/mysite/index.tpl', **index_dict))
示例#6
0
def getScores(phoneNumber, phenotypes):
    with mdb.connect('localhost', 'root', 'toor', 'userdb') as cur:
        return get_scores(phoneNumber, phenotypes, cur)