From 2c5da72a51509617fcfa8f443928fe83e49162f3 Mon Sep 17 00:00:00 2001 From: Remy Marquis Date: Thu, 5 Aug 2021 10:53:36 +0200 Subject: [PATCH] Fixed next() iterator for non square matrix --- src/main/kotlin/board/Matrix.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/board/Matrix.kt b/src/main/kotlin/board/Matrix.kt index 92a7418..275d247 100644 --- a/src/main/kotlin/board/Matrix.kt +++ b/src/main/kotlin/board/Matrix.kt @@ -29,7 +29,7 @@ class Matrix( override fun next(): T { if (!this.hasNext()) throw NoSuchElementException() - return entries[idx / n][idx++ % m] + return entries[idx / m][idx++ % m] } }