From 9ffcf58d32817f9c8bd9d511d471a76f48dddcba Mon Sep 17 00:00:00 2001 From: Emile Date: Sun, 23 Feb 2020 16:41:53 +0100 Subject: simpify next player func --- src/run.go | 8 +++----- 1 file 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 } -- cgit 1.4.1