• I really confirm the issue on my side.

    If I input the following empty code:

    function get_generation(array $cells, int $generations): array {
      return [[]]; 

    I run tests, I get, as expected, a PHPUnit error message 'Failed asserting that two arrays are equal.' because my code does not pass the tests.

    Now I add an empty class below

    function get_generation(array $cells, int $generations): array {
      return [[]]; 
    class A {}

    Hop, re-run tests: Error : Call to undefined function get_generation()

    I tried with another kata, same. No idea what is wrong with my setup. I tried another kata, same. See this recording of my browser https://watch.screencastify.com/v/Ud5L3dxTj3UOK8LLlzIv

  • I copied and pasted the nonsense code that I wrote above, but I changed return $a; to return [];, and I got the expected error: Failed asserting that two arrays are equal.

    Whatever you're doing, the tests can't find your get_generation function. It's unlikely that this is something that just affects you, as all the code is run server-side. There must be something wrong with your code. You could post it here (marked as a spoiler if it contains code pertaining to this kata).

  • I am sorry but what you just said does not work for me. I copy-paste your example and it does not work. Same error when running tests: Error : Call to undefined function get_generation()

    I have this global get_generation() function next my classes, and yet I get the error. As soon as I remove the classes, the function is found again. Can you verify, so I know if it is just me or a confirmed issue ?

  • You can use classes. Just have a global function called get_generation() and instantiate your classes in it, and run the code that way.

    So it would look like:

    class Alpha{
      private $cells;
      function __construct($cells){
        $this->cells = $cells;
        //blah blah blah
      function doStuff(){
        //blah blah blah
    class Beta{
      function test(){
        //blah blah blah
    function get_generation(array $cells, int $generations): array {
      $a = new Alpha($cells);
      $b = new Beta();
      //and so on...
      return $a;

    Something like that. The actual tests on the kata are all testing whether the get_generation function returns the correct result, so if you don't have a get_generation function to test, it won't work.

  • Oh :( disappointed. I built a solution in PHP but I use classes, a class Cell and a class Grid.

    When I use classes and I run tests, output is
    Error : Call to undefined function get_generation()

    With no classes it runs fine. So... classes are not supported by codewars PHP ?

  • You were right, I apologize. if you are struggling with this here is what I found

    // ES6 way
    const cloneSheepsES6 = [...sheeps];

    if you correct this error it also fixes the error with number 4.

  • There is only one test that checks input for changes, I think. What matters is not how often you do it, but the fact that you did it. It's not hard to avoid mutation, you can search about it online.

    JS version isn't broken at all, over 900 users completed it. You provided no real specifics or test cases that prove it is wrong, so I'm closing this, because it's not issue with kata itself, but something wrong in your code.

  • This is broken for js, it is telling me that I modified the original array but only on 1 of the 5 tests even though the code didn't change. Also all of the solutions want you to trim the excess but #4 breaks if you do?

    really sad that I spent 2 hours making this =/

  • Description should state that negative numbers will be tested

  • Check for their positive modularity

  • YOu must check for zero condition to prevent division by zero

  • Grid size changes. With some initial configurations it would grow infinitely.

    At each generation you need to apply the rules, like if you were on an infinite grid (but of course, following the rules a new alive cell may only appear in a square adjacent to some other alive cells). You must return the smallest rectangle that contains all the alive cells. Another way to see it is if row or a column on the outer part is all 0's it is deleted, but also if a new row or column contains any alive cell the grid needs to be enlarged.

    Sometimes (but generally not) the size of the initial grid is the same as the final one; but it may be because, for example, we delete a column on a side but simultaneously add one to the other side.

  • I have the same issue and did not understand that unlimited edition means that the size of the board should change. So - what does this mean, exactly? That if a row or a column is all 0's we delete the row or column? Then how do we end up with the same size grid as when we started?

  • The tests require a return of nil, not NaN – at least in Ruby. The description could describe this better.

  • Spelling in test error message: "as defined in specificaitons" (specifications)

  • Loading more items...