Introduction:
I am trying to make a simple for in a row game using python. For one of my modules I need the computer to randomly choose a character to insert in the playing grid. I would like to have more control over the odds of what character is chosen.
Python Version:
3.4
Scenario 1:
Call random.choice("XO ")
Scenario 2:
A quick hack to manipulate the odds
Call random.choice("XXOO ")
What I want:
A solution that increases the chances of an "O"
or "X"
being chosed, decrease the chance of an " "
(whitespace) being chosen
What I don't want:
Adding in more characters of the "O"
s and "X"
s to increase the odds. E.g. "XXOO "
would give me 2:1 odds for the "X"s and "O"
s
This seems like a bad hack