Closed GKnirps closed 1 year ago
Thank you! If it's a bug in the original listing make sure it goes in the porting notes at the root of that program!
Documentation added in PR #892, fix for python implementation, other implementations may still have this bug.
I'm currently working on a rust implementation of King, and I found a possible bug in the King game (game 53).
In Addition to the bug #346 (which is already documented in the
README.md
, there are these lines in the code that handle income from tourists:Now
B
(population) is around500
at the start of the game (P1
handles migration and is not of much relevance for this issue).D
(land owned) is between 2000 and 1000, so if all land is sold (D = 1000
) and the population is around the original level (which is unlikely if all land has been sold),V1
is roughly around12000
whileV2
is15000
.From what I can tell by the following code,
V1
is the amount made from tourist, whileV2
is a malus you get for environmental damage. butABS(INT(V1-V2))
means that if you have enough environmental damage, you get money from tourists again (where realistically, it should cap out at0
).In the original game, this did not really matter because of bug #346. However, the fix for bug #346 recommends to use
ABS(INT(V1-V2))
to get the amount earned by tourism. The python implementation for example uses this fix.From my understanding, it would be better to use
V1 - V2
only ifV1
is greater thanV2
and0
otherwise. However, I am not completely sure about this and I would like to have some feedback before I make a PR that documents this behaviour as a bug.