monopoly
monopoly copied to clipboard
AI declares false bankruptcy when left with lands with houses/hotels
AI is unable to sell houses/hotels on lands and as a result it declares in bankruptcy (while having more property to sell/mortgage)
https://github.com/intrepidcoder/monopoly/blob/master/ai.js#L177-192
I've had a quick look at the code, think this needs to be changed.
if (s.owner === p.index && !s.mortgage) {
if (s.house === 0) {
mortgage(i);
console.log(s.name);
} else {
// logic to sell houses/hotels in each land consecutively as needed
}
}
I'd love to open a PR with necessary changes if you want me to. Thanks!