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.
Pretty challenging and funny evilized version of the series, I like it.
This is really quite novel. Nice!
It's not dissimilar to a 'for' loop with a list. Think of it as 'for [any item] in [what I'm telling you to look at]'.
In this case we're telling the program to look at a string, so the 'any item' is just 'any/each individual letter'. 'C' is simply a placeholder for that.
I appreciate this is checks watch 11 months late, but I hope it helps if you ever return here!
If you just return True when there are 20 things marked as 1, roughly 50 TCs will pass. Is this normal?
It is a generator btw.
i used my solution for the first kata and adjusted it to fit the non adjacency rule . now it's passing all of the tests exepct like 5 of them that are like this example :
input:
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 0, 1, 0],
[1, 1, 0, 0, 1, 1, 1, 0, 1, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
after running the code :
[4, 3, 1, 0, 0, 0, 0, 0, 0, 0],
[4, 3, 0, 0, 0, 0, 0, 0, 2, 0],
[4, 3, 0, 0, 3, 3, 3, 0, 2, 0],
[4, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 2, 2, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
as you can see its prioritizing bigger ships first wich doesnt work in a minority of the cases.
any suggestions on how i should assign ships when they are next to each other
I am struggling with this kata quite a bit. I have a very verbose and not so elegant solution that seems to be passing the vast majority of test cases.
Now I think the error that im running into "Must return true if ships are touching" has to do with the priority that i use when removing ships. I start by removing the 4 cells, then 3, and then 2... however I have noticed that there are cases in which there can be multiple possible battleships and cruisers.
so I guess my question is, is backtracking required to solve this kata?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I'm confused as to why it knows c represents characters in the strings
Python random tests is very bad:
return True
can pass the random tests after some repeated submissions. See thiscool answer
This comment is hidden because it contains spoiler information about the solution
Wow!
python, inadequate random tests:
my incorrect solution often passes tests
I'd publish and link it but cw doesn't feel like publishing it. it is however my latest submission, so if you click View Solution on this post, that's the incorrect solution.
Loading more items...