Skip to content

duplicate color secret_code #12

@fuhaozuishuai

Description

@fuhaozuishuai

During testing with Mastermind, I encountered an issue: while the description permits duplicate colours in the secret_code, the code in game.py implements this using: random.sample(self.possible_colors, k=self.code_length) The random.sample() function performs sampling without replacement, meaning it cannot generate secret_codes containing duplicate colours. Should I modify how secret_codes are generated, for instance by switching to random.choice() to permit duplicate colours? The random.sample() function performs sampling without replacement, meaning it will not generate secret_codes containing duplicate colours. Should the secret_code generation method be modified, for instance by switching to the random.choice() function, to permit duplicate colours within the secret_code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions