6 kyu
Covered pawns
181 of 305mdandre
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Nice one of the chess series.
JS node 14 should be enabled
Should have sample tests on output not limited to
0
onlyDescription does not mention what does it count as having their backs covered by another
pawn
?????a pawn attack(and defend as well) only the 2 square on the sides in front of him.
This is not the case for side-most squares. You should probably mention thatattacks and defends can only be applied to diagonal squares in front of the white pawns, but bear not to exceed the boundaries of the chessboard
or something equivalentNO example tests
Other relevant information that is crucial in solving the kata should not be provided with a wiki link only
I'll try to update asap.
Covered means defended, I'll update the description. There is a link poiting to a wiki that shows you how a pawn behaves.
There are 3 example test cases.
Example tests (test cases provided in the description alongside explanations) != fixed test cases
Note: linking to wiki is not an excuse for not having to explain relevant stuffs in description. It might not be a standard for katas to be approved back in those days but that does not mean it can stand its ground && not get fixed these days!
means "if a white pawn is taken by a black piece p, is there another white pawn than can take p diagonally ?"
wtf are we supposed to do?
please explain the concept behind this...
Ruby translation. Please, review and approve (the author is inactive).
White pawns cannot be in the first row.
Yes they can. ```javascript`` [ "a1" ]
``` See?
This is not chess.
We are even asked to remember the rules of pawns. What are we remembering if not the rules of chess?
It is acceptable to deviate from those rules, but this should be specified in the kata description.
Just in case it was written "any number of pawns 0-64" that means they could occupy the first row. Anyway I updated the description...
Goodness, what's the next complaint going to be?
"There are too many pawns!" "White pawns on row 8 must promote and can't be pawns!" "There is no king! The game is lost!" "There are no black pawns! Black Pawns Matter!" "This is Not Chess!"
No, this is not chess.
@JohanWiltink
No, this is not chess.
It is, however, based on the rules of chess. The kata should be explicit where it deviates from that basis. The first row is not a legal position for pawns in chess, so, without specification, it is unclear what behavior should be expected from a pawn in this row. Can it protect a pawn in the second row? The implication is that, yes, it can, but a good spec should be explicit, not implicit.
I've seen you denigrate a kata for not being "inspired" with no indication as to what that means to you and no constructive criticism as to how the kata could be made to seem inspired (to you) and you are really going to mock me for expecting a kata to be clear about its expectations? I find you unnecessarily hostile and abbrasive and I'm not really sure why this concerns you so much.
@mdrandre: Thank you.
Random tests are vulnerable to input modification.
Sorry what does this mean?
If you run user solution first then reference solution, and they both use the same input object, then the first function (user solution) can mutate the input object to modify the expected result.
Fix: Run reference solution first:
This comment has been hidden.
Yes, which is why input modification is possible: Function evaluation are sequential so
coveredPawns
is evaluated beforesolucoveredPawns
(and thenTest.assertDeepEquals
).And you don't want that, which is why you'd want to define the two variables to reverse the order of evaluations.
(Alternatively, you can deep clone the array before passing in to the user function, but that might not work in all cases)
Ok. Thanks. I think I sorted this...in Python there is nothing of the sort?
effectively, you'll have the same problem in python. ;)
ok...sorted...every day is a school day. Now I know something else to study this week.
Fixed.
Voile, in what case would deep cloning not work?
When you have lots of deeply nested arrays, objects, strings, functions and other stuff.
(It's very rare but it sometimes happens)
Yeah, that would be difficult. :]
From JS random tests:
There are invalid pawn positions.
This has now been sorted.
JavaScript by convention uses camelCase, not snake_case.
Please follow conventions.
Updated!
Thanks!
problem in the internal solution:
This should be solved now...thanks!
That runs, but it seems your algorithm is wrong... ;)
correction: your algorithm is right and mine is wrong, but you inverted
actual
andexpected
in the assertions!Thanks! Updated.
all good!
Hi,
Interesting one, but there are some troubles with the description (I didn't try to submit yet). In my opinion:
chess and mate
kata: that's actually a piece of html code)here is the base code for the chess board (but it contains all the pieces, so if you do not update it, you'll have to clearly say in the description that the board will only contain pawns):
that gives you this:
(Errr... In the description, you should have a better display than in the message.... See here.)
You are definetely right. I'll add everything soon. Let me know.
B4B, good job!
Errr... I just did know where to find the table, I do not have the knowledge to create it myself! ;)
I would rather suggest:
and actually:
Done!
:)
Can the kata be approved?
not yet: it needs more ranking and/or upvotes.
Many thanks