So I was porting one of the old BASIC games from the book "BASIC Computer Games", Ref: https://github.com/coding-horror/basic-computer-games to Python, just for fun.
I came across the following expression in the "Fur Trader" game, which the book says works in Microsoft Basic circa 1978 (Ref: Page IX, "BASIC Computer Games"):
It's been a "few" years since I did much BASIC. I am puzzled by the use of
Is there any particular reason why the author may have chosen this syntax? Why not just use the constant
100. It seems a weird choice for a book targeted at beginners.
According to the (current) Basic manual, the operator precedence for
^ is the highest. Was this always the case?
This makes my python version look like:
int( ( 0.15 * random.random() + 0.95 ) * 100 + 0.5 ) / 100
Is it correct? My interest is getting same result as the original expression, not in preserving the actual expression.