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.
Hi, my java solution passes succesffuly most of the time! I noticed that, occasionally it fails. I analysed the situation and found that when two cuiser is stick to each other vertically, my code fails!
I correct my code to overcome, but more adjacent cruiser can be added to java test scenarios.
The field that my test failed was(two sticked cruisers cause my code to fail) :
int[][] battleField12 = {
{ 0, 0, 1, 1, 0, 0, 1, 1, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 0, 0, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 0, 0, 1, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 0, 0, 1, 0, 1, 1, 0, 0, 0 },
{ 1, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
{ 1, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
I really very enjoyed solving it! It reminds me old school days, playing that game on piece of paper!
Even the random ones somehow have never hit this case for me.
This comment is hidden because it contains spoiler information about the solution
beatiful kata
it should be 3 or 4 kyu , it is too dificult for 5
every time that i thought i was done, i was not. then i saw other people's solutions and my code looks so ugly :(
was a fun time though.
yes
Haskell fork adding random tests
I was very suprisded that I was able to complete a 3 kyu problem! This was a fun question to do.
This comment is hidden because it contains spoiler information about the solution
added for python
Merged
I don't quite understand your problem, but the rules should be the same for all ships.
Some of the bugs I faced in my solution happened only when a ship was on a bottom or right border of the desk. At the same time, fixed test don't test this (at least in Java). So I think it would be good to add such a test.
Do the rools work with all ships, or for submarines(unicellular) not? Because I wrote a code that checks if there is nothing around the ship(no contact with another ships) despite the fact it is unicellular or not(and if there is a contact, field is invalid), but I fail random tests(they want true, I have false). The only opportunity is that for submarins it works somehow another, can someone enlighten me?
Loading more items...