Was going to comment the same thing. This seems like it could be really neat, but with all of the comments in a language I can't read, I'm not entirely sure what to think, haha.
This is a bit like that fellow who did pixel art by manually writing coloured table cells in HTML in Notepad - very, very impressive, but it does make one wonder a little about the person who has done it.
Homo artist tricked me into changing it to isometric view--retarded. LOL
My computer AI was embarrassing.
The code wasn't a thing of beauty. Chess is kinda ugly with all the rules.
I have my version saved.
God says...
46:12 Hearken unto me, ye stouthearted, that are far from
righteousness: 46:13 I bring near my righteousness; it shall not be
far off, and my salvation shall not tarry: and I will place salvation
in Zion for Israel my glory.
47:1 Come down, and sit in the dust, O virgin daughter of Babylon, sit
on the ground: there is no throne, O daughter of the Chaldeans: for
thou shalt no more be called tender and delicate.
47:2 Take the millstones, and grind meal: uncover thy locks, make bare
the leg, uncover the thigh, pass over the rivers.
47:3 Thy nakedness shall be uncovered, yea, thy shame shall be seen: I
will take vengeance, and I will not meet thee as a man.
47:4 As for our redeemer, the LORD of hosts is his name, the Holy One
of Israel.
47:5 Sit thou silent, and get thee into darkness, O daughter of the
Chaldeans: for thou shalt no more be called, The lady of kingdoms.
47:6 I was wroth with my people, I have polluted mine inheritance, and
given them into thine hand: thou didst shew them no mercy; upon the
ancient hast thou very heavily laid thy yoke.
----
All memory is identity-mapped. All tasks on all cores can access all memory at all times. Memory has one address, never two. Obviously, there is no memory in the FFFFFFFFXXXXXXXX range.
I put all code in the lowest 2 Gig. 00000000-7FFFFFFF so that I can always use REL32 addressing. I never change privilege levels so I always use CALL REL32
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 :).
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.
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 script. In truth, it's not pure sed though. It uses sh (not bash), sed and ftp (or any other http client that handles 302's).
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., when someone decides to use Python as a substitute for make.
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.
sed, and also awk, and ed, are worth learning. I mean coding a chess game in those tools is just a novelty, but you can do so much really useful text processing with just those tools, and they are pretty much guaranteed to be available on almost any *nix machine.
OK I'll bite. For this answer I'll assume "easily" to mean "with less typing".
ed has a more concise syntax for joining arbitrary lines of a file (by line number or pattern) and then saving the file (by way of a temp file in $TMPDIR). You could do this with awk and perhaps with other standard tools (note: I don't consider perl to be "standard"). But I think it's safe to say the ed script would always be shorter. ed's syntax for deleting and moving arbitrary lines is similarly concise. For these specific tasks, it's not going to be easy to win at code golf using awk or other tools... and in some cases it may be impossible.
I use sed in makefiles, to scrape the source code for a version number, and then embed that version number in the name of the executable to be built. That would be easy enough in, say, Python, but as a sed script it's lightweight, decently readable, and puts everything you need to know right there in the makefile.
That said, I've recommended learning Python to a few people, but have never even suggested anybody learn sed or awk.
At one time, I became interested in the Turing-completeness of sed, and I started working on primitives for flow control and function calls. Then, I came to my senses.
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? :)
56 comments
[ 2.8 ms ] story [ 90.4 ms ] threadhttps://github.com/zeckalpha/SedChess
it has deep roots in the psyche of my old country:
http://en.wikipedia.org/wiki/The_Tale_of_Cross-eyed_Lefty_fr...
http://www.auburn.edu/~mitrege/russian-culture/lefty.doc
Homo artist tricked me into changing it to isometric view--retarded. LOL
My computer AI was embarrassing.
The code wasn't a thing of beauty. Chess is kinda ugly with all the rules.
I have my version saved.
God says...
46:12 Hearken unto me, ye stouthearted, that are far from righteousness: 46:13 I bring near my righteousness; it shall not be far off, and my salvation shall not tarry: and I will place salvation in Zion for Israel my glory.
47:1 Come down, and sit in the dust, O virgin daughter of Babylon, sit on the ground: there is no throne, O daughter of the Chaldeans: for thou shalt no more be called tender and delicate.
47:2 Take the millstones, and grind meal: uncover thy locks, make bare the leg, uncover the thigh, pass over the rivers.
47:3 Thy nakedness shall be uncovered, yea, thy shame shall be seen: I will take vengeance, and I will not meet thee as a man.
47:4 As for our redeemer, the LORD of hosts is his name, the Holy One of Israel.
47:5 Sit thou silent, and get thee into darkness, O daughter of the Chaldeans: for thou shalt no more be called, The lady of kingdoms.
47:6 I was wroth with my people, I have polluted mine inheritance, and given them into thine hand: thou didst shew them no mercy; upon the ancient hast thou very heavily laid thy yoke.
----
All memory is identity-mapped. All tasks on all cores can access all memory at all times. Memory has one address, never two. Obviously, there is no memory in the FFFFFFFFXXXXXXXX range.
I put all code in the lowest 2 Gig. 00000000-7FFFFFFF so that I can always use REL32 addressing. I never change privilege levels so I always use CALL REL32
http://awk.info/?doc/tictactoe.html
http://pastie.org/8261668
(hint: see line 14.)
edit: For anyone who wants to reproduce ("black" went first, since black appears as white on the board)
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 :).
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 script. In truth, it's not pure sed though. It uses sh (not bash), sed and ftp (or any other http client that handles 302's).
I agree its nice to see a variety of languages. Gives a fresh perspective on how to do things.
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., when someone decides to use Python as a substitute for make.
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.
ed has a more concise syntax for joining arbitrary lines of a file (by line number or pattern) and then saving the file (by way of a temp file in $TMPDIR). You could do this with awk and perhaps with other standard tools (note: I don't consider perl to be "standard"). But I think it's safe to say the ed script would always be shorter. ed's syntax for deleting and moving arbitrary lines is similarly concise. For these specific tasks, it's not going to be easy to win at code golf using awk or other tools... and in some cases it may be impossible.
That said, I've recommended learning Python to a few people, but have never even suggested anybody learn sed or awk.
- It routinely moves bishops vertically.
- It lets you make illegal moves yourself (not a huge deal).
- I got a square turning black for no reason.
Might also be nice if it told you what move it just made.
Programmer who did something like that is mad. Or he/she is from Russia.