Uh, oh. You're the James T Kirk of CodeWars. It's like beating the kobayashi maru...
This is CodeWARS, not CodeTREK!!! But also like James T Kirk, he was banned for cheating after beating the test. :)
How I got banned from Codewars
41–49 of 49 posts
Re: How I got banned from Codewars
#42I jumped into CodeWars.com just to see what it's about. Take a look at this puzzle: The code does not execute properly. Try to figure out why. int multiply(int a, char *b) { return a b; } WTF? Who the hell multiplies a char pointer with an int? Why not just a char? Do I need to multiply the pointer address or the value the pointer points at? Do I need to check for NULL? Why not write proper code instead of solving th…
Your comment is exactly the point of the puzzle. Change char to int and you gain access.
Re: How I got banned from Codewars
#43I jumped into CodeWars.com just to see what it's about. Take a look at this puzzle: The code does not execute properly. Try to figure out why. int multiply(int a, char *b) { return a b; } WTF? Who the hell multiplies a char pointer with an int? Why not just a char? Do I need to multiply the pointer address or the value the pointer points at? Do I need to check for NULL? Why not write proper code instead of solving th…
You can only make an account on the site if you solve a "puzzle" in one of the languages. It's meant to be extremely obvious to programmers but be absolute jargon to anyone else. Your comment is exactly the point of the puzzle. Change char to int and you gain access.
Re: How I got banned from Codewars
#44So the Ruby guys have an unfair advantage. As a non-Ruby guy hope they fix this. But it still feels bad. I only found that site a few days ago and it looked all flashy compared to codeforces but now - It raises severe questions about its accuracy. Kinda like Chrome dinosaur high scores.
If they allowed FORTH it would be even worse -- everything in FORTH is redefinable -- you could make 1 equal to 2 if you want.
Re: How I got banned from Codewars
#45Earlier quoted context omitted.
If they allowed FORTH it would be even worse -- everything in FORTH is redefinable -- you could make 1 equal to 2 if you want.
Is that why nobody uses it anymore? Only thing I know about it is that it used stack like expressions. (kinda like RPN but for everything)
Re: How I got banned from Codewars
#46I'm surprised that the test for pass/fail is within the interpreter, rather than a string match against the stdout of a sandboxed interpreter.
Some programming shop just revealed that they don't know how to think about security.
STDOUT/IN based challenges cause developers to have to program esoteric challenges that they would never see in real life, and write code that they would never use for anything other than a challenge site.
Re: How I got banned from Codewars
#47Earlier quoted context omitted.
Some programming shop just revealed that they don't know how to think about security.
The entire point to the site is that programming challenges using STDIN/OUT is not how you write code. So yes, you can cheat - but who cares. At least you get to write real code. Not to mention the number of things that can be tested for since you are able to use real testing frameworks. STDOUT/IN based challenges cause developers to have to program esoteric challenges that they would never see in real life, and writ…
Couldn't you have the same programming challenges, but not have STDIN/OUT?
Re: How I got banned from Codewars
#48Earlier quoted context omitted.
If they allowed FORTH it would be even worse -- everything in FORTH is redefinable -- you could make 1 equal to 2 if you want.
I don't believe there's anything that would prevent that in Ruby, though I'm sure the Forth way would be more elegant.
$ irb
2.4.1 :001 > 1.class
=> Integer
2.4.1 :002 > class Integer
2.4.1 :003?> def 1
2.4.1 :004?> 2
2.4.1 :005?> end
2.4.1 :006?> end
SyntaxError: (irb):3: syntax error, unexpected tINTEGER
def 1
^
(irb):6: syntax error, unexpected keyword_end, expecting end-of-input
That's not unexpected as small numeric literals are magic in Ruby, for performance reasons.More evidence:
2.4.1 :001 > class Integer
2.4.1 :002?> define_method(:one) { 1 }
2.4.1 :003?> end
=> :one
2.4.1 :004 > Integer.one
NoMethodError: undefined method `one' for Integer:Class
2.4.1 :005 > Integer.new.one
NoMethodError: undefined method `new' for Integer:Class
2.4.1 :006 > Integer.new
NoMethodError: undefined method `new' for Integer:Class
2.4.1 :007 > class Klass
2.4.1 :008?> define_method(:one) { 1 }
2.4.1 :009?> end
=> :one
2.4.1 :010 > Klass.one
NoMethodError: undefined method `one' for XY:Class
2.4.1 :011 > Klass.new.one
=> 1
So Integer is not like other classes and the actual reason for that http://archive.oreilly.com/pub/post/the_ruby_value_1.htmlTLDR MRI gets the value of the number directly from value of the C pointer and saves the lookup. It's a 1 in the lowest bit and the integer value in the others. That's why 0.object_id == 1, 1.object_id == 3, etc
Obviously that's implementation dependent but I guess no Ruby implementation is going us to redefine integers if MRI does not.