diff options
author | Emile <hanemile@protonmail.com> | 2020-02-23 16:41:53 +0100 |
---|---|---|
committer | Emile <hanemile@protonmail.com> | 2020-02-23 16:41:53 +0100 |
commit | 9ffcf58d32817f9c8bd9d511d471a76f48dddcba (patch) | |
tree | cd4fc4b6830db9f68a3a50301d52dadfa2b58bc1 /src/run.go | |
parent | 6dc2e05313efa4bf0bffcd80a64fe4d24773a692 (diff) |
simpify next player func
Diffstat (limited to 'src/run.go')
-rw-r--r-- | src/run.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/run.go b/src/run.go index a422ddf..7b346cb 100644 --- a/src/run.go +++ b/src/run.go @@ -15,13 +15,11 @@ func stepIn(r2p *r2pipe.Pipe) { _ = r2cmd(r2p, "aes") } -func switchPlayer(r2p *r2pipe.Pipe, currentPlayer int, config Config) int { +// switchPlayer returns the id of the next Player +func switchPlayer(r2p *r2pipe.Pipe, currentPlayer int, config *Config) int { // calculate the index of the nextPlayer - nextPlayer := (currentPlayer + 1) % len(config.Bots) - - // restore the registers to the state of the next bot - r2cmd(r2p, config.Bots[nextPlayer].Regs) + nextPlayer := (currentPlayer + 1) % config.AmountOfBots return nextPlayer } |