Draft
Knight and the Castle
Loading description...
Geometry
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.
It is a fun kata but it is still need some fix. Please have a look at https://i.imgur.com/hhdKi4v.jpg
similar to what damjan had addressed before.
uh, thank you for your reply! i might actually take this kata down for some time to rethink my solution and generation of the test cases in order to fix this problem and prevent them from occuring!
Sorry for submitting so many bug reports, but I really want this kata to work! It's quite fun.
Random point:
([1, 99], {1: [76, 32], 2: [19, 43], 3: [84, 81], 4: [94, 68]})
(plot)✘ 2 should equal 3
But as you can see in the plot, the knight can only see two towers from his position in the upper left corner.
Thanks a lot! I've found the origins of this problem, it's more complicated, though. The kata will be unpublished for a while. However, I have an idea of solving it.
Alright, I look forward to trying it again when it's finished. :) My solution only worked for convex polygons so I'll have to rethink that too. >_>
I've rewritten random test cases complitely, looking forward to your feedback!
I got this as a random test case: {1: [22, 81], 2: [41, 18], 3: [73, 1], 4: [29, 20]}
This isn't a convex polygon, though. So you might want to either fix that or update the description.
Oh, you the real MVP! (Fixed :))
Very cool kata, but I think there's a bug -- either with the test cases or with my solution.
Test case 2:
O: [0, 0], A: {1: [0, 2], 2: [2, 4], 3: [5, 4], 4: [7, 0], 5: [4, 0]}
Expected:2
Here, two towers and the knight are colinear, and only the first is counted. (The tower at (7,0) is blocked by the tower at (4,0)).
Test case 3:
O: [4, 0], A: {1: [0, 4], 2: [6, 5], 3: [5, 3], 4: [4, 2], 5: [3, 2], 6: [1, 3]}
Expected:6
But in this case, the colinear tower at (0, 4) is counted despite being blocked by the tower at (1,3)!
Thanks for your note! You are right, there was a mistake in the third test case that has been fixed. Try it now!
Awesome! Thanks for fixing it so quickly. :) Unfortunately, I have another problem though... I'll add a separate comment for it.