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.
https://www.codewars.com/kata/greed-is-good/discuss#56f9b8f0e4d45d96b1001130
How about some more tests with ones and fives?
Nice one.. You also could've put $count = 0 to function parameters, it would save you a line.. array_walk_recursive is very powerful in cases with multidimentional arrays.. good job
Hi terminus_technicus,
the problem with the given class should be resolved. It is not necessary to write a class to solve this kata, so the description is correct as it is. The purpose of the given class is to make the random test cases working. But I misplaced the class for my translation attempt, so the given error occured.
SleepingCode helped me getting this working. It should be possible to train the kata now.
Hey bobtrigg,
the issue should be resolved. I misplaced the given class in the attempt to translate the kata to PHP. SleepingCode fixed this issue, so you should be able to train this kata now.
If any other problems should occur, please don't hesitate to inform us again :-)
Yes, seems to work now! Okay, lessions learned. Solution code for random test cases will be written into the test cases in future work.
I am used to seperate my code in real projects and misused the preload section for this purpose. Thanks for helping!
Ok, now I'have copypasted the code and it has not given me any issue.
I only changed the position of the class 'PolynomialSimplifierSolution' from preloaded code to test cases, so to prevent some cunning guy to use it from its code.
Use preloading only if:
. you give some black-box utility functions with an API, so that the user can call them without bothering about details of the implementation (useful if you want to implement a kata difficult in an abstract way (for example Object oriented)).
. you want forbid the usage of a specific keyword (for example goto) or a specific library so that, e.g., if a function in a library does already what your kata asks you can force people to implement it themselves.
. probably something else...
As I mentioned at my fork three days ago:
"It seems to me that the old translation is still used (where the preloaded class for the test cases is sill missing).
Could you try do figure out how to get the new fork running?
This translation thing is much more confusing than initially thought ;-)"
The old version is still used. I have no idea how I could change this, so I hope you can choose the version which should be used?! You can try it out by training the PHP version and clicking "run suit" directly. If "Error: Class 'PolynomialSimplifier' not found" is still in the output, the old version is used, because I renamed the class to "PolynomialSimplifierSoltuion" for the Test Cases in the working fork.
Sorry for bothering you, but the bug doesn't seem to be fixed...
It seems to that the old translation is still used (where the preloaded class for the test cases is sill missing).
Could you try do figure out how to get the new fork running?
This translation thing is much more confusing than initially thought ;-)
Approved!
Hey, indeed. I forgot to preload a class for the testcases.
There is a new fork of my translation with the correct preload and updated test cases. When I try to edit my original translation I get an error with the message "Description cannot be approved, recent changes from related record must be merged first.". So I hope forking my translation was the correct way of handling this error.
Hi, there is an issue about test cases, could you check out the Discourse?
Thanks
Hey SleepingCode,
calling me would be great, thank you :-) It was my first kata translation, so I would appreciate every feedback I can get.
Hi, I'm going to approve your kata.
However, I must warn you that there have been a lot of complaints about bugs int the random test cases for the other languages.
If someone complains I'll call you, ok?