From 175525230ac46917d0203eb9a3bb6b13d40fa828 Mon Sep 17 00:00:00 2001 From: David Florness Date: Fri, 5 Feb 2021 19:25:27 -0500 Subject: [PATCH] Use two dimensional array instead of map of maps I must've been tired when I wrote the original. --- election/voter.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/election/voter.go b/election/voter.go index 0d7dcef..697d9f4 100644 --- a/election/voter.go +++ b/election/voter.go @@ -307,13 +307,11 @@ func printResults(result []byte, candidates []Candidate) { } return y } - p := make(map[int]map[int]int) + p := make([][]int, len(candidates)) for i := range candidates { + p[i] = make([]int, len(candidates)) for j := range candidates { if i != j { - if p[i] == nil { - p[i] = make(map[int]int) - } if result[i*n+j] > result[j*n+i] { p[i][j] = int(result[i*n+j]) } else { -- 2.38.4