From 083c4cdd9f5dfba244cd5e14b95a5249a7a07423 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:03:49 -0800 Subject: [PATCH 01/14] Create introduction.md --- .../eliuds-eggs/.docs/introduction.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 exercises/practice/eliuds-eggs/.docs/introduction.md diff --git a/exercises/practice/eliuds-eggs/.docs/introduction.md b/exercises/practice/eliuds-eggs/.docs/introduction.md new file mode 100644 index 0000000..2b2e5c4 --- /dev/null +++ b/exercises/practice/eliuds-eggs/.docs/introduction.md @@ -0,0 +1,65 @@ +# Introduction + +Your friend Eliud inherited a farm from her grandma Tigist. +Her granny was an inventor and had a tendency to build things in an overly complicated manner. +The chicken coop has a digital display showing an encoded number representing the positions of all eggs that could be picked up. + +Eliud is asking you to write a program that shows the actual number of eggs in the coop. + +The position information encoding is calculated as follows: + +1. Scan the potential egg-laying spots and mark down a `1` for an existing egg or a `0` for an empty spot. +2. Convert the number from binary to decimal. +3. Show the result on the display. + +## Example 1 + +![Seven individual nest boxes arranged in a row whose first, third, fourth and seventh nests each have a single egg.](https://assets.exercism.org/images/exercises/eliuds-eggs/example-1-coop.svg) + +```text + _ _ _ _ _ _ _ +|E| |E|E| | |E| +``` + +### Resulting Binary + +![1011001](https://assets.exercism.org/images/exercises/eliuds-eggs/example-1-binary.svg) + +```text + _ _ _ _ _ _ _ +|1|0|1|1|0|0|1| +``` + +### Decimal number on the display + +89 + +### Actual eggs in the coop + +4 + +## Example 2 + +![Seven individual nest boxes arranged in a row where only the fourth nest has an egg.](https://assets.exercism.org/images/exercises/eliuds-eggs/example-2-coop.svg) + +```text + _ _ _ _ _ _ _ +| | | |E| | | | +``` + +### Resulting Binary + +![0001000](https://assets.exercism.org/images/exercises/eliuds-eggs/example-2-binary.svg) + +```text + _ _ _ _ _ _ _ +|0|0|0|1|0|0|0| +``` + +### Decimal number on the display + +8 + +### Actual eggs in the coop + +1 From e205d164b5c77b6b6beb0203aeefcd182f6f72d4 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:06:06 -0800 Subject: [PATCH 02/14] Create instructions.md --- exercises/practice/eliuds-eggs/.docs/instructions.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 exercises/practice/eliuds-eggs/.docs/instructions.md diff --git a/exercises/practice/eliuds-eggs/.docs/instructions.md b/exercises/practice/eliuds-eggs/.docs/instructions.md new file mode 100644 index 0000000..b0c2df5 --- /dev/null +++ b/exercises/practice/eliuds-eggs/.docs/instructions.md @@ -0,0 +1,8 @@ +# Instructions + +Your task is to count the number of 1 bits in the binary representation of a number. + +## Restrictions + +Keep your hands off that bit-count functionality provided by your standard library! +Solve this one yourself using other basic tools instead. From 577d0441c4c6aaa0be33aba85b5abc63e2eba46c Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:06:59 -0800 Subject: [PATCH 03/14] Create config.json --- .../practice/eliuds-eggs/.meta/config.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 exercises/practice/eliuds-eggs/.meta/config.json diff --git a/exercises/practice/eliuds-eggs/.meta/config.json b/exercises/practice/eliuds-eggs/.meta/config.json new file mode 100644 index 0000000..d0cddbe --- /dev/null +++ b/exercises/practice/eliuds-eggs/.meta/config.json @@ -0,0 +1,17 @@ +{ + "authors": [], + "files": { + "solution": [ + "EliudsEggs.bat" + ], + "test": [ + "EliudsEggsTest.bat" + ], + "example": [ + ".meta/Example.bat" + ] + }, + "blurb": "Help Eliud count the number of eggs in her chicken coop by counting the number of 1 bits in a binary representation.", + "source": "Christian Willner, Eric Willigers", + "source_url": "https://forum.exercism.org/t/new-exercise-suggestion-pop-count/7632/5" +} From 4644b762ae60d9ce84b7cf0fccc3ab54e4ff55e9 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:07:57 -0800 Subject: [PATCH 04/14] Update config.json --- exercises/practice/eliuds-eggs/.meta/config.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/practice/eliuds-eggs/.meta/config.json b/exercises/practice/eliuds-eggs/.meta/config.json index d0cddbe..07f8ca4 100644 --- a/exercises/practice/eliuds-eggs/.meta/config.json +++ b/exercises/practice/eliuds-eggs/.meta/config.json @@ -1,5 +1,7 @@ { - "authors": [], + "authors": [ + "slashedOaccuteOmega" + ], "files": { "solution": [ "EliudsEggs.bat" From aa44bd9a680ac00ceee77df61a1cb526ff60fe28 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:13:06 -0800 Subject: [PATCH 05/14] Create Example.bat --- exercises/practice/eliuds-eggs/.meta/Example.bat | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 exercises/practice/eliuds-eggs/.meta/Example.bat diff --git a/exercises/practice/eliuds-eggs/.meta/Example.bat b/exercises/practice/eliuds-eggs/.meta/Example.bat new file mode 100644 index 0000000..8e3dd07 --- /dev/null +++ b/exercises/practice/eliuds-eggs/.meta/Example.bat @@ -0,0 +1,15 @@ +@echo off +setlocal enabledelayedexpansion + +set /a n=%~1 +set /a count=0 + +:loop +if %n% EQU 0 goto :done +set /a bit=n %% 2 +set /a count+=bit +set /a n=n/2 +goto :loop + +:done +echo %count% From 3d891d2b78d61de527c2c1aad070170d8bcd015d Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:17:47 -0800 Subject: [PATCH 06/14] Create EliudsEggs.bat --- exercises/practice/eliuds-eggs/EliudsEggs.bat | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 exercises/practice/eliuds-eggs/EliudsEggs.bat diff --git a/exercises/practice/eliuds-eggs/EliudsEggs.bat b/exercises/practice/eliuds-eggs/EliudsEggs.bat new file mode 100644 index 0000000..11d9ee1 --- /dev/null +++ b/exercises/practice/eliuds-eggs/EliudsEggs.bat @@ -0,0 +1,10 @@ +@echo off +setlocal enabledelayedexpansion + +set /a n=%~1 +set "result=" + +REM Your code goes here + + +echo %result% From 53cbe5e905452606ec0e2d4fe02e381f059d9305 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:18:53 -0800 Subject: [PATCH 07/14] Create tests.toml --- .../practice/eliuds-eggs/.meta/tests.toml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 exercises/practice/eliuds-eggs/.meta/tests.toml diff --git a/exercises/practice/eliuds-eggs/.meta/tests.toml b/exercises/practice/eliuds-eggs/.meta/tests.toml new file mode 100644 index 0000000..e11683c --- /dev/null +++ b/exercises/practice/eliuds-eggs/.meta/tests.toml @@ -0,0 +1,22 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[559e789d-07d1-4422-9004-3b699f83bca3] +description = "0 eggs" + +[97223282-f71e-490c-92f0-b3ec9e275aba] +description = "1 egg" + +[1f8fd18f-26e9-4144-9a0e-57cdfc4f4ff5] +description = "4 eggs" + +[0c18be92-a498-4ef2-bcbb-28ac4b06cb81] +description = "13 eggs" From 1cbb68db2234f9ba310f67ec2488476694d35812 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:22:19 -0800 Subject: [PATCH 08/14] Update config.json --- exercises/practice/eliuds-eggs/.meta/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/eliuds-eggs/.meta/config.json b/exercises/practice/eliuds-eggs/.meta/config.json index 07f8ca4..26b7452 100644 --- a/exercises/practice/eliuds-eggs/.meta/config.json +++ b/exercises/practice/eliuds-eggs/.meta/config.json @@ -1,6 +1,6 @@ { "authors": [ - "slashedOaccuteOmega" + "nastamattina" ], "files": { "solution": [ From 558baee92dc732b4012782d72bc3fd52280bc188 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:23:22 -0800 Subject: [PATCH 09/14] Create EliudsEggsTest.bat --- .../practice/eliuds-eggs/EliudsEggsTest.bat | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 exercises/practice/eliuds-eggs/EliudsEggsTest.bat diff --git a/exercises/practice/eliuds-eggs/EliudsEggsTest.bat b/exercises/practice/eliuds-eggs/EliudsEggsTest.bat new file mode 100644 index 0000000..8594efb --- /dev/null +++ b/exercises/practice/eliuds-eggs/EliudsEggsTest.bat @@ -0,0 +1,120 @@ +@echo off +setlocal enabledelayedexpansion +REM --------------------------------------------------- +REM EliudsEggs Unit Testing +REM +REM sUnit Testing Framework version: 0.3 +REM --------------------------------------------------- + +set isTestRunner=false +if "%1" == "test-runner" ( + set isTestRunner=true +) + +set "successCount=0" +set "failCount=0" + +:Main + REM Initalize result variable + set "slug=EliudsEggs" + + REM -------------------- + REM Test Case Start \/\/ + REM Resource: https://github.com/exercism/problem-specifications/blob/main/exercises/eliuds-eggs/canonical-data.json + REM -------------------- + + set "expected=0" + set "if_success=Test passed" + set "if_failed=Test failed: 0 eggs." + CALL :Assert "0" + + set "expected=1" + set "if_success=Test passed" + set "if_failed=Test failed: 1 egg." + CALL :Assert "16" + + set "expected=4" + set "if_success=Test passed" + set "if_failed=Test failed: 4 eggs" + CALL :Assert "89" + + set "expected=13" + set "if_success=Test passed" + set "if_failed=Test failed: 13 eggs." + CALL :Assert "2000000000" + + REM -------------------- + REM Test Case End /\/\/\ + REM -------------------- + + CALL :ResolveStatus + exit /b %errorlevel% +REM End of Main + +REM --------------------------------------------------- +REM Assert [..Parameters(up to 9)] +REM --------------------------------------------------- +GOTO :End REM Prevents the code below from being executed +:Assert +set "stdout=" + +REM Run the program and capture the output then delete the file +set filePath=%slug%.bat +if "%isTestRunner%"=="true" ( + set filePath=.meta\Example.bat +) +set batPath=%~dp0 +CALL %batPath%%filePath% %~1 %~2 %~3 %~4 %~5 %~6 %~7 %~8 %~9 > stdout.bin 2>&1 +for /f "delims=" %%A in (stdout.bin) do ( + set "line=%%A" + if defined stdout ( + set "stdout=!stdout!\n!line!" + ) else ( + set "stdout=!line!" + ) +) +del stdout.bin + +REM Check if the result is correct +if "%stdout%" == "%expected%" ( + if defined if_success ( + echo %if_success% + + REM Reset the variable to avoid duplicating the message. + set "if_success=" + set "if_failed=" + ) + + REM If the result is correct, exit with code 0 + set /a successCount+=1 + exit /b 0 +) else ( + if defined if_failed ( + echo %if_failed% + + REM Reset the variable to avoid duplicating the message. + set "if_success=" + set "if_failed=" + ) + + REM If the result is incorrect, exit with code 1 + set /a failCount+=1 + exit /b 1 +) +GOTO :EOF REM Go back to the line after the call to :Assert + +:ResolveStatus +set "status=" +if %failCount% gtr 0 ( + REM status: Fail + REM message: The test failed. + exit /b 1 + +) else ( + REM status: Pass + exit /b 0 + +) +GOTO :EOF REM Go back to the line after the call to :ExportResultAsJson + +:End From e1c2e2f43a14253b7a6a347d9bed4a5258520ad8 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:23:38 -0800 Subject: [PATCH 10/14] Update EliudsEggsTest.bat --- exercises/practice/eliuds-eggs/EliudsEggsTest.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/eliuds-eggs/EliudsEggsTest.bat b/exercises/practice/eliuds-eggs/EliudsEggsTest.bat index 8594efb..76d950b 100644 --- a/exercises/practice/eliuds-eggs/EliudsEggsTest.bat +++ b/exercises/practice/eliuds-eggs/EliudsEggsTest.bat @@ -35,7 +35,7 @@ set "failCount=0" set "expected=4" set "if_success=Test passed" - set "if_failed=Test failed: 4 eggs" + set "if_failed=Test failed: 4 eggs." CALL :Assert "89" set "expected=13" From b7eb9064bd057c7726500c6de9d7128e67694ab9 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:27:58 -0800 Subject: [PATCH 11/14] Update config.json --- config.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config.json b/config.json index bbc8a52..24ce570 100644 --- a/config.json +++ b/config.json @@ -114,6 +114,19 @@ ], "difficulty": 1 }, + { + "slug": "eliuds-eggs", + "name": "Eliud's Eggs", + "uuid": "0875c5f0-8336-494b-b32a-b9d789d32ea7", + "practices": [ + "basics", + "bitwise-operations", + "loops", + "numbers" + ], + "prerequisites": [], + "difficulty": 1 + }, { "slug": "darts", "name": "Darts", From 0e605c5dc43b46bafa790aa2cd91467db29f0397 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:40:05 -0800 Subject: [PATCH 12/14] Update config.json --- config.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 24ce570..7ef470d 100644 --- a/config.json +++ b/config.json @@ -119,12 +119,13 @@ "name": "Eliud's Eggs", "uuid": "0875c5f0-8336-494b-b32a-b9d789d32ea7", "practices": [ - "basics", "bitwise-operations", "loops", + ], + "prerequisites": [ + "basics", "numbers" ], - "prerequisites": [], "difficulty": 1 }, { From 91f2ec94f0a1b3b03053d6e44cda1f9cb95d2307 Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 10:50:00 -0800 Subject: [PATCH 13/14] Update config.json --- config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json b/config.json index 7ef470d..f003b33 100644 --- a/config.json +++ b/config.json @@ -116,7 +116,7 @@ }, { "slug": "eliuds-eggs", - "name": "Eliud's Eggs", + "name": "Eliuds Eggs", "uuid": "0875c5f0-8336-494b-b32a-b9d789d32ea7", "practices": [ "bitwise-operations", From 8dfd6a91f4485c655687cb28ec854f5257ee44df Mon Sep 17 00:00:00 2001 From: nstama Date: Tue, 24 Feb 2026 11:03:12 -0800 Subject: [PATCH 14/14] Update config.json --- config.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index f003b33..de4606e 100644 --- a/config.json +++ b/config.json @@ -119,12 +119,11 @@ "name": "Eliuds Eggs", "uuid": "0875c5f0-8336-494b-b32a-b9d789d32ea7", "practices": [ - "bitwise-operations", "loops", + "numbers" ], "prerequisites": [ - "basics", - "numbers" + "basics" ], "difficulty": 1 },