• ###### vmcnabbcommented on "Convert a Number to a String!" javascript solution

Need a third vote option: "funny".

• ###### vmcnabbcommented on "Convert a Number to a String!" javascript solution

"cheating" in this context is a joke. Of course I'd use a built in method.

• ###### vmcnabbresolved an issue on "ISRC - Significant Figures" kata

Nice catch. That's because `(0.075).toPrecision(1)` is working off a number slightly smaller than 0.075. I have updated the kata.

• ###### vmcnabbcommented on "ISRC - Significant Figures" kata

How is it different from the mathematical definition?

• ###### vmcnabbcommented on "ISRC - Significant Figures" kata

Because 0.0012 is two significant figures.

• ###### vmcnabbcommented on "ISRC - Significant Figures" kata

I just double checked the test cases, and couldn't see this issue. There is a test case, (99, 3) which expects "99.0", and a separate one, (98.5, 2) which expects 99.

• ###### vmcnabbcommented on "Did I Finish my Sudoku?" csharp solution

I can confirm, it's fairly easy to construct a board that should fail, but passes this test.

var rows = new int[][]
{
new int[] {4, 4, 4, 6, 7, 8, 9, 1, 2},
new int[] {6, 7, 2, 1, 9, 5, 3, 4, 8},
new int[] {1, 9, 8, 3, 4, 2, 5, 6, 7},
new int[] {8, 5, 9, 7, 6, 1, 4, 2, 3},
new int[] {4, 2, 6, 8, 5, 3, 7, 9, 1},
new int[] {7, 1, 3, 9, 2, 4, 8, 5, 6},
new int[] {9, 6, 1, 5, 3, 7, 2, 8, 4},
new int[] {2, 8, 7, 4, 1, 9, 6, 3, 5},
new int[] {4, 3, 5, 2, 8, 6, 1, 7, 9},
};

• ###### vmcnabbcommented on "Coordinates Validator" javascript solution

So... it needs more test cases.

• ###### vmcnabbcommented on "Adding Big Numbers" javascript solution

~ is a bitwise not. It has the side effect of converting any value into an int first. Doing it twice has a similar effect as parseInt(x), except you will never get NaN.
So

``````~~"3" === 3
~~"3.9" === 3
~~true === 1
~~"unparsable string" === 0
~~(false or NaN or undefined or null or [] or [1,2,3] or {...} ) === 0
~~[7] === 7
``````

In the first line of the for block, I'm using it to convert the string values to ints.
In the third line of the for block, I'm truncating the decimal part of the division.

• ###### vmcnabbcommented on "Tiny Three-Pass Compiler" kata

Heh, fun takes priority over TV any day.

I look forward to more kata from you.

• ###### vmcnabbcommented on "Conway's Game of Life" javascript solution

Probably shouldn't have written that comment at the top.

I was just feeling annoyed because I'd just completed the code, clicked Attempt, and the first thing it does is moan about me not having a guard condition.

On the topic of sanitizing input:

External input should always be sanitized, but internal input should be correct to begin with. If it's not correct, then it's a bug in the code generating the input that should be fixed.

Incorrect internal input should crash the entire execution path that lead to the input. The above function would crash on an empty array without the guard condition, so in this particular case, there isn't much point in a guard condition.

Pretending it's OK, sanitizing it, and continuing is not a particularly safe way of doing it.

• ###### vmcnabbcommented on "Tiny Three-Pass Compiler" kata

Nice, kata, and cute little language... Thanks for all the effort you put into making this :-)

I'm sure I could make my solution better, but I already had to miss my favourite TV show, you bastard!

• ###### vmcnabbcommented on "ISRC - Significant Figures" javascript solution

Woops, I forgot to test that a proper amount of significant figures was created for values like 0.1 with 4 sf (which is 0.1000)

• ###### vmcnabbcommented on "The Fruit Juice" kata

Nice kata. However, the description does not say what to return when contents don't exist.