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.
This comment is hidden because it contains spoiler information about the solution
When a player successfully connects 4, the game should end. Therefore, except in the case of a draw, the colour of the last move is the winning colour. It's a trick question!
The instructions for this kata are very unclear.
This comment is hidden because it contains spoiler information about the solution
I strongly agree. I had to make 3 different attempts -- each with a different set of assumptions of what the author might ask me to do -- before I was able to complete this Kata.
This Kata is too dificult for level 7 kyu. The description is also very poor.
That's exactly right! Those groups are called "4-connected components" in this kata (and in topological image processing). Now you can try to solve it to consolidate the theory :)
I think i get it now: A group of pixels is 4-connected if and only if: Starting at any one pixel in that group, you can arrive at any other pixel in that group by moving directly up, down, left or right onto another pixel in the same group or (in the case of a group consisting of a single pixel) by not moving at all.
Here is an example: https://postimg.cc/bDQPq7wP
Top grid: if we define one group as being all the squares that are coloured black, then the group of black squares forms a 4-connected group. I can start anywhere and arrive anywhere by either not moving or by moving up, down, left or right onto a black square. If we consider all the white squares to form one group, then this group is not 4-connected. HOWEVER if we consider each of the adjacent pairs of white squares to be seperate groups then we can say that the white squares as a whole form two seperate 4-connected groups.
Bottom Grid: The black squares do not form a 4-connected group but we can consider two seperate clusters of black squares to be 2 seperate 4-connected groups distinct from each other. The same goes for the white squares which DO NOT FORM a 4 connected group but can be segregated into two seperate groups each of which is 4-connected.
It counts as one, since every point inside the component can be reached from every other point. I know it can be confusing, but every point can be reached from itself, and since the maximal set of points that constitute the connected component is formed by only one point, then all the points can be reached from every other point in the component (strictly speaking).
It's important to note that the set of points must be maximal, meaning that an image cannot have a connected component that is a subset of another component.
Maybe I misunderstood it @Dr Gabo, but I'm assuming this would count as 1 component, no ?
If not, are there any tests for this? Most solutions consider this valid.
You are kind of on the right track, I'll explain it again because some people seem to still have problems undestanding the concept. A single pixel is never 4-connected by itself, but you can calculate whether or not two pixels are 4-connected. We say that the second assertion holds when they are connected vertically or horizontally (but not diagonally).
In other words:
Thus, a 4-connected component is a bunch of pixels where you can go from any pixel to any other by only "jumping" between 4-connected pixels.
I hope you understand now :)
The description does seem a bit confusing, but there's no need for wikipedia. I think the simplest way I could describe it is: a cluster of connected
*
s form 1 component (in such way, that if you pick any 2 of those*
, you could travel from 1 to the other one by following connected*
s, whether it's up,down,left or right).If it's just a sole pixel not connected to any other, it still counts as a component. Description shows 2 components: the larger one on the left, and one on the right (4 connected pixels). It may seem like there's more of them, but it's just that spacing between rows is bigger and it looks like there's black pixels in-between :/
Does that make it any clearer? =/
I can't work out what you mean by a 4-connected pixel. I read the wikipedia page and it seemed very simple: a pixel is 4-connected if it there is another pixel of the same colour above, below, to the left and to the right of itself. In other words, it is 4-connected if: when you move one space up, down, left or right, you will arrive at another pixel of the same colour. This definition would imply that there is only 1 white connected pixel in the example you have used in the description. Is it possible that you could explain what you mean by a 4-connected pixel in a very simple way - i've read through the previous clarifying exaplanations you have given but i don't understand them.
Many thanks!
Now they are very good.
The Instructions for this kata are very poorly worded.