Skip to content

Commit

Permalink
Simplify matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
dustalov committed Jul 8, 2024
1 parent 1966030 commit 5929fe8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ pub fn matrices(
let mut wins = Array2::zeros((n, n));
let mut ties = Array2::zeros((n, n));

for i in 0..xs.len() {
match ws[i] {
for ((x, y), &ref w) in xs.iter().zip(ys.iter()).zip(ws.iter()) {
match w {
Winner::X => {
wins[[xs[i], ys[i]]] += 1;
wins[[*x, *y]] += 1;
}
Winner::Y => {
wins[[ys[i], xs[i]]] += 1;
wins[[*y, *x]] += 1;
}
Winner::Draw => {
ties[[xs[i], ys[i]]] += 1;
ties[[ys[i], xs[i]]] += 1;
ties[[*x, *y]] += 1;
ties[[*y, *x]] += 1;
}
_ => {}
}
Expand Down

0 comments on commit 5929fe8

Please sign in to comment.