From aed96bcaf851497f0c9cbf3232038a8346d9a7f4 Mon Sep 17 00:00:00 2001 From: Murat Kirazkaya Date: Thu, 19 Sep 2024 13:51:55 +0300 Subject: [PATCH 1/5] grains error message and test cases updated --- exercises/practice/grains/.docs/instructions.append.md | 3 +++ exercises/practice/grains/.docs/instructions.md | 2 +- exercises/practice/grains/.meta/Example.bat | 6 +++--- exercises/practice/grains/GrainsTest.bat | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 exercises/practice/grains/.docs/instructions.append.md diff --git a/exercises/practice/grains/.docs/instructions.append.md b/exercises/practice/grains/.docs/instructions.append.md new file mode 100644 index 0000000..a2c31e0 --- /dev/null +++ b/exercises/practice/grains/.docs/instructions.append.md @@ -0,0 +1,3 @@ +#### Independent of other languages + +Batch supports only up to 31 bits so we need to use a different approach to solve, Instead of writing code according to the range 1 to 64, the range `1 to 31` is important for us. diff --git a/exercises/practice/grains/.docs/instructions.md b/exercises/practice/grains/.docs/instructions.md index df479fc..d29e1a0 100644 --- a/exercises/practice/grains/.docs/instructions.md +++ b/exercises/practice/grains/.docs/instructions.md @@ -7,7 +7,7 @@ The king promised to pay whatever the servant could dream up. Knowing that the king loved chess, the servant told the king he would like to have grains of wheat. One grain on the first square of a chess board, with the number of grains doubling on each successive square. -There are 64 squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on). +There are 64 _(But because of language limitations, we take 31 in batch testing)_ squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on). Write code that shows: diff --git a/exercises/practice/grains/.meta/Example.bat b/exercises/practice/grains/.meta/Example.bat index a888154..2fb24d8 100644 --- a/exercises/practice/grains/.meta/Example.bat +++ b/exercises/practice/grains/.meta/Example.bat @@ -4,12 +4,12 @@ setlocal EnableDelayedExpansion set "input=%~1" if %input% LSS 1 ( - echo square must be between 1 and 64 + echo square must be between 1 and 31 exit /b 1 ) -if %input% GTR 64 ( - echo square must be between 1 and 64 +if %input% GTR 31 ( + echo square must be between 1 and 31 exit /b 1 ) diff --git a/exercises/practice/grains/GrainsTest.bat b/exercises/practice/grains/GrainsTest.bat index c745602..b03ea5b 100644 --- a/exercises/practice/grains/GrainsTest.bat +++ b/exercises/practice/grains/GrainsTest.bat @@ -49,19 +49,19 @@ if "%1" == "test-runner" ( set "if_failed=Test failed: grains on square 31." CALL :Assert "31" - set "expected=square must be between 1 and 64" + set "expected=square must be between 1 and 31" set "if_success=Test passed" set "if_failed=Test failed: square 0 is invalid." CALL :Assert "0" - set "expected=square must be between 1 and 64" + set "expected=square must be between 1 and 31" set "if_success=Test passed" set "if_failed=Test failed: negative square is invalid." CALL :Assert "-1" - set "expected=square must be between 1 and 64" + set "expected=square must be between 1 and 31" set "if_success=Test passed" - set "if_failed=Test failed: square greater than 64 is invalid." + set "if_failed=Test failed: square greater than 31 is invalid." CALL :Assert "65" REM -------------------- From cf4c2b4e9c6460482f369d141045bcd62f83c37e Mon Sep 17 00:00:00 2001 From: Murat Kirazkaya <77299279+GroophyLifefor@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:51:07 +0300 Subject: [PATCH 2/5] grains - Typo fix in exercise instruction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com> --- exercises/practice/grains/.docs/instructions.append.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/grains/.docs/instructions.append.md b/exercises/practice/grains/.docs/instructions.append.md index a2c31e0..b8516a8 100644 --- a/exercises/practice/grains/.docs/instructions.append.md +++ b/exercises/practice/grains/.docs/instructions.append.md @@ -1,3 +1,3 @@ -#### Independent of other languages +# Independent of other languages Batch supports only up to 31 bits so we need to use a different approach to solve, Instead of writing code according to the range 1 to 64, the range `1 to 31` is important for us. From d7d999e0b527e311f6bdd17bffe357e6f2381fe6 Mon Sep 17 00:00:00 2001 From: Murat Kirazkaya Date: Fri, 20 Sep 2024 14:53:27 +0300 Subject: [PATCH 3/5] grains instruction rollback for clean movement --- exercises/practice/grains/.docs/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/grains/.docs/instructions.md b/exercises/practice/grains/.docs/instructions.md index d29e1a0..df479fc 100644 --- a/exercises/practice/grains/.docs/instructions.md +++ b/exercises/practice/grains/.docs/instructions.md @@ -7,7 +7,7 @@ The king promised to pay whatever the servant could dream up. Knowing that the king loved chess, the servant told the king he would like to have grains of wheat. One grain on the first square of a chess board, with the number of grains doubling on each successive square. -There are 64 _(But because of language limitations, we take 31 in batch testing)_ squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on). +There are 64 squares on a chessboard (where square 1 has one grain, square 2 has two grains, and so on). Write code that shows: From ba0a5b5457eb2afc49d37b65ce7d46e95fd949c9 Mon Sep 17 00:00:00 2001 From: Murat Kirazkaya <77299279+GroophyLifefor@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:54:13 +0300 Subject: [PATCH 4/5] grains exercise docs improvement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: András B Nagy <20251272+BNAndras@users.noreply.github.com> --- exercises/practice/grains/.docs/instructions.append.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/practice/grains/.docs/instructions.append.md b/exercises/practice/grains/.docs/instructions.append.md index b8516a8..0abee72 100644 --- a/exercises/practice/grains/.docs/instructions.append.md +++ b/exercises/practice/grains/.docs/instructions.append.md @@ -1,3 +1,4 @@ # Independent of other languages -Batch supports only up to 31 bits so we need to use a different approach to solve, Instead of writing code according to the range 1 to 64, the range `1 to 31` is important for us. +However, the king ran out of grains to give the servant after day 31 since 1,073,741,824 grains is approximately 54 metric tons. +As a 32-bit language, Batch can't represent the number of grains past this point. From 6069938970f50b98a46f2ec5225e63de31e1eede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:41:52 -0700 Subject: [PATCH 5/5] Update tests.toml --- exercises/practice/grains/.meta/tests.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exercises/practice/grains/.meta/tests.toml b/exercises/practice/grains/.meta/tests.toml index e5bb24e..262ef21 100644 --- a/exercises/practice/grains/.meta/tests.toml +++ b/exercises/practice/grains/.meta/tests.toml @@ -26,10 +26,13 @@ description = "returns the number of grains on the square -> grains on square 16 [acd81b46-c2ad-4951-b848-80d15ed5a04f] description = "returns the number of grains on the square -> grains on square 32" +include = false +comment = "Batch is 32-bit so square 31 is maximum possible" [c73b470a-5efb-4d53-9ac6-c5f6487f227b] description = "returns the number of grains on the square -> grains on square 64" include = false +comment = "Batch is 32-bit so square 31 is maximum possible" [1d47d832-3e85-4974-9466-5bd35af484e3] description = "returns the number of grains on the square -> square 0 is invalid" @@ -39,6 +42,8 @@ description = "returns the number of grains on the square -> negative square is [a95e4374-f32c-45a7-a10d-ffec475c012f] description = "returns the number of grains on the square -> square greater than 64 is invalid" +include = false +comment = "Batch is 32-bit so the test description, input, and expected value all were changed" [6eb07385-3659-4b45-a6be-9dc474222750] description = "returns the total number of grains on the board"