Show HN: Astro-Bot – A programming question with every new tab

  • Pretty cool! However, some riddles are incorrect, for example this one has two errors:

      def foo( vals ):
        output = vals[0]
        for x in vals[1:]:
          if output < x:
            output = x
        return x
    
    1. It should return output

    2. The answer should be "The maximum value", not "The minimum value"

    Also, it could be nice if after you solve a riddle you would get a new one.

  • Wouldn’t a better idea be to show a question on Stack Overflow which is somewhat upvoted but still without an accepted answer?

  •     $ git checkout -b feature
    
    The answer to this is wrong -- got green on "merge two branches" rather than "create and then checkout a new branch called 'feature'".

  • Why would I want to be distracted while doing a task that serves a certain purpose? I must be the only one not just opening new tabs out of boredom :P

  • The following is incorrect for finding a missing number in a sequence.

      func foo( _ nums: [Int] ) -> Int {
        var sum = 0
        var _ = nums.map {sum += $0}
    
        return (nums.count * ((nums.count+1) / 2)) - sum
      }
    
    
    The last line should be

      return ((nums.count+1) * ((nums.count+2) / 2)) - sum
    
    The count of nums will give the incorrect answer since it's already missing a value.

  • I enjoyed it, but you should allow me to disable random HackerNews links. That's not the purpose of the extension.

  • Nice! It would be cool if there was some kind of points to denote how many questions we have answered correctly.

  • Is there a Firefox version?

  • #include<stdio.h>

    int main() { int array[] = { 1, 2, 3, 4, 5}; int *ptr; ptr = a; ptr++;

        return 0; 
    }

    This won't compile, but the answer says it should be 2