make all decisions before enacting any

This commit is contained in:
Luke Meyers 2020-02-08 20:21:17 -08:00
parent 1dbe8786b3
commit 879260f719
1 changed files with 5 additions and 0 deletions

View File

@ -5,9 +5,14 @@ import (
) )
func UpdateState(s State, sOld State) State { func UpdateState(s State, sOld State) State {
cmds := make([]command, len(s.Teams))
for i := range s.Teams { for i := range s.Teams {
cmd := smartChooseCommand(s, i) cmd := smartChooseCommand(s, i)
log.Printf("team %d chose to %v", i, cmd) log.Printf("team %d chose to %v", i, cmd)
cmds[i] = cmd
}
for i, cmd := range cmds {
s = doCommand(cmd, s, i) s = doCommand(cmd, s, i)
} }