Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Haskell translation
What regex can consistently get countries from string like these:
I solved it without regex (check solution because spoiler)
This comment is hidden because it contains spoiler information about the solution
python new test frameworks
Perhaps my description of the kata will make more sense:
Description
Amidakuji is a lottery method designed to create random pairs between two sets of the same size.In this kata the elements of the first set are whole numbers from 0 to 6. Your task is to write an
amidakuji
function that returns second set comprised of converse numbers.Input
Your function will receive an array of equal-length strings consisting of 0 and 1 characters; this represents the "ladder" structure. The
1
represent the rungs of the ladder and the0
represent empty space.Take a look at the diagram below:
Row
0
of the ladder is'001001'
string, which means there will be two horizontal bridges at this row; one between the vertical lines 2 and 3 and another between vertical lines 5 and 6. When proceed to move down vertical lines, a transition is made to the adjacent vertical line over the nearest bridge.Output
The diagram above is a visual representation of
ladder
argument of the function.At the top of the diagram the 2 has a third position, in the aftermath of the ladder it got a second position. The yellow highlighted path shows the path taken by the 2 value. Every time it encounters a bridge, it moves to the opposite vertical line.
Your function should return an array of numbers, with each number in its final position.
When I was trying to submit a python solution, it passed all the fixed tests, but when it got to random I got an error
My solution seems to work with the random test cases, but somehow it still gives the error
python new test framework
Unless I've gone blind, there's almost nothing explained about the Allow/Deny a nation. Do I have to check in a whitelist manner (nation has to be in allow list) or blacklist manner (nation must not be in deny list) or do I combine them to one list in either manner, where one method removes from list, other adds to it? Additionally, do the countries aggregate or get reset between days?
i'm coding in the golang version and i'm sure there's something wrong with one of the tests
given that the lower bound is 100000 and the upper bound is 12345678900000000, but somehow the answer is only 718650, which from what I calculated is way less then just the total for a 16 upside-down number sum. So, now im also wondering if actual tests are correct or not.
That was a really nice kata
One small suggestion; the description states:
It left me wondering whether completing two boxes at once provided with 2 extra turns or only 1. It turns out it is the latter. Perhaps this could be mentionned ?
C++ translation published
In Java's sample tests (
sampleTest2
) :The assertion:
always succeeds because in
assertFailPopulate()
:the
genToLstOfMap()
(which is a tests suite function, not a user function)throws
anullPointerException
when called oninvalidGen
, andnullPointerException
is an instance ofRuntimeException
. So the assertion always succeeds and the user's code is not even called.This solution in JS should be patched
Entry denied: missing required work pass.
Passport check case for Ban nations and expiry date
Above cases are not guaranteed in JS at least (should have fixed tests for that)
Although I have yet to solve the kata, I had found some troublesome issues that are discussed in discourse but not stated or highlighed clearly in description. (More to add as time goes...
Description does not mention that the given examples of
bulletin
rules are strictly written in such format. In other words, solvers may assume cases like below will occurForeigners do not require access permit
Workers do not require work pass
Do not allow citizen of Republia
etc...
Description does not mention accumulation of bulletin rulesets are to be expected and preceding bulletins for following days will override existing / previous ones. It only mentions
criminals
should be handled based on the bulletin given on that day.Description does not mention that by-default, all nations except Arstotzka itself will be denied.
Message formatting for mismatch information resulting in detainment is not specified. Only example below is mentioned. (So, what about Nationality, name, DOB etc. mismatches???)
Same goes for expiration validation on different documents (No implication that
_
are to be replaced with space)The specification for
vaccination
is unclear.Will each entrant receive more than one vaccine??? (Yes, apparantly...
How is the bulletin for vaccination defined??? Is it that~~ ??
The next bulletin ruleset regarding vaccination will always negate the previous case , with possibly additional ruleset for allowing other kinds of vaccinations for specific regions (EX:
Entrants require tetanus vaccination
followed byEntrants no longer require tetanus vaccination
&& possiblyCitizens of Impor require hepatitis B vaccination
)Patially duplicate vaccinations ruleset may occur (ex:
Citizens of Impor, Republica require polio vaccination
&&Citizens of Impor, Obristan require cowpox vaccination
)Non-existing vaccination rulesets will be defined (ex:
Foreigners no longer require cowpox vaccination
with no prior vaccination ruleset beforehand)For now, one may assume only the 1st case occur based on the test cases, but it is not guaranteed anymore...
Does not mention the validation on required documents (passports, IDs, permits (if any)) should be done before vaccination validation
Loading more items...