示例#1
0
def random_game(game_id: GameId = None,
                first_peg: CodePeg = None,
                second_peg: CodePeg = None,
                third_peg: CodePeg = None,
                fourth_peg: CodePeg = None) -> Game:
    game_id = random_game_id() if game_id is None else game_id
    first_peg = random_code_peg() if first_peg is None else first_peg
    second_peg = random_code_peg() if second_peg is None else second_peg
    third_peg = random_code_peg() if third_peg is None else third_peg
    fourth_peg = random_code_peg() if fourth_peg is None else fourth_peg

    return Game(game_id, first_peg, second_peg, third_peg, fourth_peg)
def random_create_game_command(game_id: str = None,
                               first_peg: str = None,
                               second_peg: str = None,
                               third_peg: str = None,
                               fourth_peg: str = None) -> CreateGameCommand:
    game_id = random_game_id().game_id if game_id is None \
        else game_id
    first_peg = random_code_peg().peg_type if first_peg is None \
        else first_peg
    second_peg = random_code_peg().peg_type if second_peg is None \
        else second_peg
    third_peg = random_code_peg().peg_type if third_peg is None \
        else third_peg
    fourth_peg = random_code_peg().peg_type if fourth_peg is None \
        else fourth_peg

    return CreateGameCommand(game_id, first_peg, second_peg, third_peg,
                             fourth_peg)
示例#3
0
def random_create_guess_command(
        guess_id: str = None,
        game_id: str = None,
        first_code_peg: int = None,
        second_code_peg: int = None,
        third_code_peg: int = None,
        fourth_code_peg: int = None) -> CreateGuessCommand:
    guess_id = random_guess_id().guess_id if guess_id is None else guess_id
    game_id = random_game_id().game_id if game_id is None else game_id
    first_code_peg = random_code_peg().peg_type if first_code_peg is None \
        else first_code_peg
    second_code_peg = random_code_peg(
    ).peg_type if second_code_peg is None else second_code_peg
    third_code_peg = random_code_peg().peg_type if third_code_peg is None \
        else third_code_peg
    fourth_code_peg = random_code_peg(
    ).peg_type if fourth_code_peg is None else fourth_code_peg
    return CreateGuessCommand(guess_id, game_id, first_code_peg,
                              second_code_peg, third_code_peg, fourth_code_peg)
示例#4
0
def random_game_response(game_id: str = None,
                         first_peg: str = None,
                         second_peg: str = None,
                         third_peg: str = None,
                         fourth_peg: str = None)->GameResponse:
    game_id = random_game_id().game_id if game_id is None \
        else game_id
    first_peg = random_code_peg().peg_type if first_peg is None \
        else first_peg
    second_peg = random_code_peg().peg_type if second_peg is None \
        else second_peg
    third_peg = random_code_peg().peg_type if third_peg is None\
        else third_peg
    fourth_peg = random_code_peg().peg_type if fourth_peg is None\
        else fourth_peg

    return GameResponse(
        game_id,
        first_peg,
        second_peg,
        third_peg,
        fourth_peg
    )