The greatest collection of the worst code.
- Practice the fundamentals
- Expose common mistakes
- Lab to theorycraft mechanics
- Docker
- Composer
- NPM
npm i
npm run restart
./vendor/bin/sail kata:run
Calculate the value of pi.
namespace App\Challenges\A;
class Sample
{
public function calculatePi(): float
{
$denominator = 1;
$sum = 0;
for ($i = 0; $i < 100000; $i++) {
$sum = ($i % 2 === 0)
? $sum + (4 / $denominator)
: $sum - (4 / $denominator);
$denominator += 2;
}
return $this->return(round($sum, 2));
}
}
namespace App\Challenges\B;
class Sample
{
public function calculatePi(): float
{
return $this->return(round(M_PI, 2));
}
}
Katas are code challenges focused on improving skill and technique. Some train programming fundamentals, while others focus on complex problem solving. Some are puzzles meant to test your creative problem solving, while others are based on real world coding scenarios.
The term was first coined by Dave Thomas, co-author of the book The Pragmatic Programmer as an acknowledgment to the Japanese concept of kata in the martial arts. Dave's version of the concept defines a code kata as an exercise in programming which helps a programmer sharpen their skills through practice and repetition. - Codewars