Live data from Hacker News

Chess written in sed

github.com

51–57 of 57 posts

Re: Chess written in sed

#51
post #17

There's an error in line 1024. The transform strings are not the same length. I'd like to see more sed programs on HN instead of the usual Python, Ruby or Go offerings. I wrote a sed version of the the Python script "youtube-dl". This way I don't need Python installed to download YouTube videos. And it's easy to edit if YouTube suddenly changes their "API"; no need to wait for someone else to fix their Python or Lua…

You have to use Unicode sed.

Ah. Thanks. I just assumed a strictly POSIX sed would work. My mistake.

Re: Chess written in sed

#52
post #17

There's an error in line 1024. The transform strings are not the same length. I'd like to see more sed programs on HN instead of the usual Python, Ruby or Go offerings. I wrote a sed version of the the Python script "youtube-dl". This way I don't need Python installed to download YouTube videos. And it's easy to edit if YouTube suddenly changes their "API"; no need to wait for someone else to fix their Python or Lua…

Are you frequently on a unix platform without python? Just out of interest. I agree its nice to see a variety of languages. Gives a fresh perspective on how to do things.

Neither do I

Re: Chess written in sed

#53

Earlier quoted context omitted.

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 perh…

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.

Re: Chess written in sed

#55
post #50

Earlier quoted context omitted.

Are you frequently on a unix platform without python? Just out of interest. I agree its nice to see a variety of languages. Gives a fresh perspective on how to do things.

Yes. I never need to install Python permanently.[1] In my experience, there is almost always a way to do what needs to be done with what UNIX provides, without installing more software. This keeps the system smaller, more standardized and hence more portable than one where various dependencies are haphazardly added. 1. Sometimes I have to install it temporarily, for "reverse engineering" a non-Python solution, e.g.,…

Ya totally! I still telnet to my servers... Don't want to fill my system with extra software. :P

Re: Chess written in sed

#56
post #55
post #50

Earlier quoted context omitted.

Yes. I never need to install Python permanently.[1] In my experience, there is almost always a way to do what needs to be done with what UNIX provides, without installing more software. This keeps the system smaller, more standardized and hence more portable than one where various dependencies are haphazardly added. 1. Sometimes I have to install it temporarily, for "reverse engineering" a non-Python solution, e.g.,…

Ya totally! I still telnet to my servers... Don't want to fill my system with extra software. :P

Not sure I understand your comment.

Like sed, all UNIX systems provide ssh. It's not "extra software". There's no need to use telnet.

On the other hand, not all UNIX systems have Python pre-installed. Moreover, as in the case of embedded products, not all systems may have the space for it.

Re: Chess written in sed

#57
I love how he felt compelled to excuse his omission of castling and en passant moves by explaining that they were added to chess "later" (14th and 15th century)... maybe he started working on this project before those rules were added? :)
Post reply on HN