Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider implementing worse bot randomness to make the game more interesting #257

Open
davidyuk opened this issue Dec 6, 2022 · 0 comments

Comments

@davidyuk
Copy link
Member

davidyuk commented Dec 6, 2022

export function getRandomMoveCallData(contract: ContractInstance): {
move: Moves;
calldata: Encoded.ContractBytearray;
} {
const randomMove = Math.floor(Math.random() * 3);
const move = Object.values(Moves)[randomMove];
return {
move,
calldata: contract.calldata.encode(CONTRACT_NAME, Methods.player1_move, [
move,
]),
};
}

In terms of game theory, if one of the participants chooses the strategy to make fully random decisions then the outcome of multiple games would be approximately the same amount of wins and losses on each side. And this outcome not depending on the decisions of the other party which makes the game boring.

If the bot decreases randomness in its strategy like doing Math.floor(Math.random() * Math.random() * 3), so the first move would be chosen more frequently then the user can guess it and play against this decision. It would be more interesting, but the bot would have a big risk of losing its coins.

A stronger strategy for the bot would be to assume that the opponent doesn't generate a good random, so to predict the next move by calculating the most frequent move based on the last 10 moves of the opponent, and to play against that move.

The bot can switch strategy during the game, keeping its balance at an acceptable level. If implementing something like this consider making the bot's source code private to avoid building the ideal user strategy based on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant