The students in my high school computer science class were asked to write the game of nim for a simple project. Most of them found it very easy and finished quickly. However, one student came up with this solution. I'll probably make them redo it anyway, but I'm wondering if anyone can understand what's going on.
enum $ {
$$;
static int _, $_$, $_, _0_;
{
{
{
{
_$ $_ = _$.__;
}
}
}
}
enum _$ {
__(new byte[][]{
"\nNumber of stones: \0\nPlayer one move: \0Computer takes \0\nComputer wins!\n\0\nPlayer wins!\n".getBytes(),
new byte[]{(byte) (_ = (int) (Math.random() * (_ = ((_ = -~_) * (_ << -~-~_) + -~-~-~_ + -~ ~ ~-~_)) + _))}},
null);
java.io.Console ___ = System.console();
_$(byte[] _$_[], String $[]) {
for ($ = new String(_$_[$_$]).split(Character.toString((char) $_$)); _ > 0;) {
___.printf($[$_$] + _);
do _0_ = ___.readLine($[-~$_$]).getBytes()[$_$] - 060;
while (_0_ > -~-~-~$_$ || _0_ > _);
_ -= $_$ + _0_ >> $_$;
if (((!(!(((!((!((_) < -~($_ = $_$))))))))))) break;
_ -= $_ = Math.min((int) (Math.random() * -~-~-~$_$ + -~$_$), _);
___.printf($[-~-~$_$] + $_);
}
___.printf(($_$ = -~-~-~$_$) > _ ? $[$_ > 0 ? -~$_$ : $_$] : $[2]);}}};
`