Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Exercise]: Killer Sudoku Helper #284

Merged
merged 2 commits into from
Oct 1, 2023

Conversation

glaxxie
Copy link
Contributor

@glaxxie glaxxie commented Sep 25, 2023

No description provided.

Copy link
Member

@meatball133 meatball133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tiny nits


Throw "Please implement this function"
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few trailing new lines, it is a tiny bit but it is an easy fix

$got = Invoke-KillerSudokuHelper -Sum 7 -Size 3 -Exclude @()
$want = @( ,@(1, 2, 4))

,$got | Should -BeExactly $want
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this, , is intended to be here.


It "Cage with only 1 possible combination" {
$got = Invoke-KillerSudokuHelper -Sum 7 -Size 3 -Exclude @()
$want = @( ,@(1, 2, 4))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is sorta ugly having the , before the array, when I removed the , mentioned in the comment above, it does work to remove that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the "," indeed the test still work. My reason for it was how powershell unroll their array depending on context.
$want = @( @(1, 2, 4))
$want.Count will be equal 3.
However $want = @( ,@(1, 2, 4))
$want.Count will be equal 1.

Technically speaking, want count should only be 1, because there is only one possible way to fill out the cells.

For this problem, it probably doesnt matter regardless when the array solution only consist of one solution of inner array.
But I think there should be an exercise to teach students about this behavior later

-Fix some blank lines and update test file
@meatball133 meatball133 merged commit bd47f3d into exercism:main Oct 1, 2023
3 checks passed
@glaxxie glaxxie deleted the pwrshll_killer_sudoku_helper branch December 7, 2023 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants