COMMUNITY

Codewars.com now supports Haxe!

The language support is officially in beta. There are almost no existing exercises (known in Codewars as kata), so interested members of the community (myself included) will have to contribute some!

Basically you can just sign up on the Codewars website, get 75+ honor by doing other languages’ kata, and then you can create your own Haxe kata! Codewars consists entirely of community-created katas, so anyone can contribute!

Links:

9 Likes

That sounds neat, thank you very much!

I wouldn’t mind creating some katas, but I have no idea how tbh.

I did found that the tests are are flipped. “expected B, but got A” but should be “expected A, but got B”. My input is on the left side where it should be at the other side.

In utest.Assert, the expected value comes first :slight_smile:

Discourse formats links weirdly but the two GitHub wiki links I posted are the official Codewars documentation on how to create new kata.

The gist of the process is creating a test suite that you’d like the programmer to get to pass. They’re unable to see/edit the tests and have to read the instructions and example input/output to figure out how to solve it.

You can get a better idea of how the kata work by trying out some kata from other languages; Codewars supports a ton!

@Nezteb I looks like it tries to extract the name from a class definition in the Code (I get Failed to detect class name. error when there’s no class is defined). I wonder why that is needed, because in Haxe a module can contain different kinds of named types (class, interface, abstract, typedef), also module-level static vars and functions are coming soon.

If it’s just to determine the module name (a .hx file), I would suggest just hard-coding it to something like Code.hx and then add import Code; to the test cases, which will import all the definitions from the module into the namespace of the test module.

My best guess is to simplify the Codewars sandbox implementation.

The original GitHub issue where I requested Haxe support is here: https://github.com/codewars/codewars-runner-cli/issues/810#issuecomment-624351288

User kazk did all the actual work. Codewars’ sandbox implementations themselves are not open source that I know of but they do accept GH issues and are pretty responsive.

Thanks, I’ll just copy-paste my comment there ^^

This post was marked as spam/advertisement despite being a free online learning resource that could directly help those who are new to Haxe. My guess is that people saw the title and assumed I was trying to sell something without actually verifying it first? :man_shrugging:

Nope, that’s discourse automated spam prevention :man_shrugging: I’ve restored the posts

1 Like

Oh good to know! The message I got implied someone in the community flagged it. :joy:

Anyway, less than 6 hours for a response, not bad! :smiley: https://github.com/codewars/codewars-runner-cli/issues/810#issuecomment-625440746