Hacker Newsnew | past | comments | ask | show | jobs | submit | eddington's commentslogin

They "fixed" it. Well, there's still another.

https://hulbee.com/?query=%3C%2Fscript%3E%3Cimg%20src%3Dsdf%...

It runs on Chrome and bypasses the filter.

Edit: for context, the parent found an XSS issue. It was patched within a few hours. The patch was incomplete, and this one still worked. So, not only do they get it wrong for launch. When presented with an exploit they don't even patch the full vulnerability. I'll trust my data with someone who understands security, thank you very much.


There appears to be a bug. Here is the state I reached (notice that "white" now has two bishops of the same color).

      a b c d e f g h
    8 ♖ ♘ ♗ ♕ ♔   ♘ ♖ 
    7 ♙ ♙ ♙ ♙ ♙ ♗     
    6                 
    5             ♙   
    4     ♝ ♟ ♟       
    3               ♙ 
    2 ♟ ♟ ♟     ♟ ♟ ♟ 
    1 ♜ ♞ ♝   ♚   ♞ ♜ 

Someone want to submit a pull request? :-)

edit: For anyone who wants to reproduce ("black" went first, since black appears as white on the board)

    1. e4 h5
    2. d4 h4
    3. Bb4 h3
    4. Qf3 g5
    5. Qxf7 Bxf7??


On my first game I got an even better bug:

  a b c d e f g h
8 ♔       ♛ ♝ ♘

7 ♙ ♙ ♙ ♙

6

5         ♙

4       ♟ ♟     ♕

3   ♟ ♞

2 ♟   ♟     ♟   ♟

1 ♜     ♛ ♚ ♝   ♜

After performing en passant the computer went crazy and the King started taking all the pieces between down row 8. I ended up with a very easy checkmate as I walked my pawn the remaining three rows, unfettered even when it was under double pressure from the night and queen.

I wonder if this is perhaps an issue caused by the fact I used OS X's BSD sed.

Edit: Hmm, can't seem to format it right. Anyways, the bug seems to be present in gnu sed as well. Really the whole game was screwy. I started with e2 e4 and it all went down hill from their for my opponent :).


The readme says passant isn't implemented, and there's no validation of the player's moves. So you did an illegal move.


Interesting. Either way my opening seemed to be more problematic as the computer still went out of its way to checkmate itself without the en passant. Still a cool achievement.


I just tried this in real life and got the same bug. Hmmm.


It also seems to allow some illegal moves. The computer moved its bishop like a rook.


Complete solution to today's problem in one line of python

def gen(univ, n=5): return univ if n == 1 else [x+y for y in gen(univ,n-1) for x in univ if all([(x+y)[start:start+upto] != (x+y)[start+upto:start+upto*2] for start in range(len(x+y)) for upto in range(1,(len(x+y)-start+2)/2)])]

... god that looks ugly. Call it with

>>> gen(["1", "2", "3"], 5) ['13121', '23121', '21321', '31321', '12321', '12131', '32131', '21231', '31231', '13231', '13212', '23212', '21312', '12312', '32312', '12132', '32132', '23132', '21232', '31232', '31213', '13213', '23213', '12313', '32313', '32123', '13123', '23123', '21323', '31323']


And in some rather nicer Perl:

    sub solutions {
    	my ( $target_length, $alphabet, $head ) = @_;
    	$head //= '';    

    	# Base Case our head is the right length
    	return $head if (length $head) == $target_length;

    	# General Case
    	return
    		map  { generate( $target_length, $alphabet, $_ ) }    
    		grep { ! /(.{2})\1/ }
    		map  { $head . $_ }
    		@$alphabet;
    }
eg:

    my @solutions = solutions( 5, [1..3] );


Is that accurate? This looks like it only checks for sequential runs of two characters apiece.

The challenge calls for sequences "such that no two immediately adjacent subsequences are equal".

This, to me, implies subsequences of any length > 1.

For a $target_length of 5, your solution is correct as 2 is the longest repeatable subsequence.

Easy fix, of course:

  grep { ! /(.{2})\1/ }
becomes

  grep { ! /(.{2,})\1/ }
I wonder if it would help performance to say:

  grep { $max = length()/2; $max < 2 || ! /(.{2,$max})\1/ }
Or if the regexp engine manages to do that automatically.

[UPDATE: it is slower to provide your own max length. the perl regexp engine is badass. repeating timings on my mac pro with a target_length of 12 show the plain {2,} version is 15% quicker].

(also, you've a minor typo as you recurse into "generate" instead of "solutions", I assume b/c you renamed the function at the very end to make the eg: code scan better).


That's quite pretty Perl. You've lessened my prejudice against the language by writing code that can be read.


Here is an ugly iterative solution, in one lambda:

  from itertools import product
  f = lambda n: [
    s for s in
      map(''.join, product("abc", repeat=n))
    if not any(a==b
      for a,b in
        [(s[a:b], s[b:c])
         for a,b,c in
           [(i,i+w,i+2*w)
            for w in range(1,len(s)/2+1)
            for i in range(len(s)-2*w+1)]])]



  >>> f(5)
  ['abaca', 'abacb', 'abcab', 'abcac', 'abcba', 'acaba',
   'acabc', 'acbab', 'acbac', 'acbca', 'babca', 'babcb', 
   'bacab', 'bacba', 'bacbc', 'bcaba', 'bcabc', 'bcacb', 
   'bcbab', 'bcbac', 'cabac', 'cabca', 'cabcb', 'cacba', 
   'cacbc', 'cbabc', 'cbaca', 'cbacb', 'cbcab', 'cbcac']


Please leave those elsewhere.


I'll reward +1 internet to anyone that reply with more weird smiley-faces! :)


I'm surprised to see a comment like this from someone who has an account that was created over 1,700 days ago.


Relevant quote: "It's bad behavior you want to keep out more than bad people. User behavior turns out to be surprisingly malleable. If people are expected to behave well, they tend to; and vice versa." http://www.paulgraham.com/hackernews.html


One of the authors of that book taught a class earlier this year at Berkeley. If you learn best listening, the lectures might help. I found them a bit easy, but a nice overview of the book.

http://webcast.berkeley.edu/playlist#c,d,Computer_Science,EC...


It's worth noting that not every bug is a security-critical bug. Similarly, not every crash is a security-critical crash.

Sometimes you can exploit a bug to give you something, sometimes it's just a plain old bug.

People only pay for the security-critical ones.


I don't know why you're saying it isn't NP-complete. For an arbitrary set of coins, it's definitely NP-complete. You could easily reduce 0-1 ILP to it, or subset-sum.

If you don't believe me, believe http://graal.ens-lyon.fr/~abenoit/algo09/coins2.pdf

"Optimally making change—representing a given value with the fewest coins from a set of denominations—is in general NP-hard."


You're correct, but the article makes exactly the same point as you. There's no reason to correct it.


Why is this comment being downvoted? It's not aggressive, rude or otherwise mean. It's also not factually incorrect (because it's talking about a possible future).

I agree that I don't believe this future is likely, but that's no reason to downvote him.


You might want to fix this in case you ever decide to add a way to log on:

http://scrib.in/m27dy7

(I added the text </textarea><img src=g onerror="alert(1)"> and went to view it.)


cool! I can confirm that it works :)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: