Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

SedSokoban

Posted by michael on Thu Mar 21, 2002 03:32 AM
from the things-that-should-be-illegal-but-aren't dept.
rsd writes: "Have you ever thought that sed is too limited and only useful to Regular Expression scripts? Well, verde666, who works for Conectiva, proved that it can be used for games too. He wrote a sokoban game named sedsokoban with sed. There is even a screenshot."
+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • One question: (Score:1, Insightful)

    Does pressing 'u' allow you to undo bad moves?

    (This was the case in the original, or at least the older, Sokoban for XTs.)

    • No. (Score:4, Informative)

      by marnanel (98063) <slashdot@marnane ... g minus language> on Thursday March 21 2002, @04:13AM (#3199080) Homepage Journal

      Unfortunately not-- though I'm sure you could submit a patch if you felt like it. See the docs:

      #r h or <left-arrow> - move left
      #r j or <down-arrow> - move down
      #r k or <up-arrow> - move up
      #r l or <right-arrow> - move right

      There's a handler in there for the "p" key, though I'm still not sure what it's supposed to do. It seems to put sed into an infinite loop.

  • Here's a mirror of the screenshot.

    http://www.zianet.com/endikos/sedsokoban.png [zianet.com]
  • by BoBaBrain (215786) on Thursday March 21 2002, @03:44AM (#3199022)
    It's possible to sculpt Venus using only a nail file (and a lump of marble).
    That doesn't mean nail files are any more useful than we thought.
    • I still use sed on occaision, although there's really nothing you can do in sed that you can't do with 'perl -e ...'. Partly this is because se style re's were just burned into my impressionable young brain back in the days of System III, but also I think that sed really embodies the Unix tools philosophy -- build simple tools that do one thing extremely well.

      Of course this kind of hack shows that even simple tools can be used in unexpected ways. This is a good lesson to remember. This is a little OT, but I was thinking about this fact the other day when I was listening to people talk about placing blame for the security lapses on 9/11. One way to defeat security is to find behavioral possibilities inherent in the implementation of a system that aren't part of its design. In retrospect, it's easy to see you can smash a stack by putting machine language instructions into an unchecked buffer, but this attack was highly original the first time it was attempted. In retrospect, it easy to see that a large airliner loaded with fuel is a flying bomb, but to see this in advance is harder.

  • by marnanel (98063) <slashdot@marnane ... g minus language> on Thursday March 21 2002, @03:46AM (#3199027) Homepage Journal
    Today it's Sokoban... beware, for before you know it it'll be Elite [fortunecity.com].
  • Ummm....What? (Score:3, Interesting)

    by Tranvisor (250175) on Thursday March 21 2002, @03:53AM (#3199043) Homepage
    First of all what is sed? Sorry for being late to the party here, but come on, I have no idea what this is about other then somebodies little text-like game?

    Mike, don't you think that you could have contributed like a sentence at the end saying something that would bring the picture a little more into the real world focus? Heck, I would settle for something like "Sed is normally used for ........ to do ..... Pretty interesting use of sed because ......"

    Just a thought.
    • Re:Ummm....What? (Score:5, Informative)

      by anpe (217106) on Thursday March 21 2002, @04:01AM (#3199055)
      Sed stands for Stream EDitor. It's part of the New Command-Line eXPerience(tm) that Microsoft ships with Microsoft Word (tm) so that the user can easily writte DOS-mode games while editing.

      If you really don't know what SED is, then Google's your friend : http://directory.google.com/Top/Computers/Software /Editors/SED/
      • Re:Ummm....What? (Score:3, Informative)

        I hope whoever moderated this to "informative" isn't taking it entirely seriously...

        sed stands for "Stream EDitor" yes, but it is not at all to do with Microsoft. sed has been a staple command used with Unix operating systems for a long, long time and you'll find details about using it in any good Unix book.
    • Re:Ummm....What? (Score:5, Informative)

      by marnanel (98063) <slashdot@marnane ... g minus language> on Thursday March 21 2002, @04:04AM (#3199066) Homepage Journal
      Sed is a stream editor-- it takes a file and modifies it according to your instructions (such as "add a space at the start of every line"). Here's a quick introduction [cornerstonemag.com], and here's the sed FAQ [northpark.edu] from comp.editors.
    • Sed is a UNIX command that's mostly used for automated search and replace like editing of text files (to other unix heads who are screaming now, I know its more than that but I'm trying to simplify). It has a programming language built into it but its really cryptic and not nearly as usefull as the regexp search replace feature and so the vast majority of people don't use it, and writing a game out of it is just masochistic (somewhat like the guy that wrote a webserver in postscript). He didn't describe what it was because to anyone who's used unix its almost second nature. Too often people forget that a windows user or whatnot wouldn't have any exposure to such things.
    • Re:Ummm....What? (Score:4, Informative)

      by FuegoFuerte (247200) on Thursday March 21 2002, @04:30AM (#3199111)
      As people have now already said ( yah yah, I know... redundant. Shut up already...) sed is the Stream EDitor. Windows people probably would have no clue what sed is. People new to *nix systems probably would have no clue what sed is. It is often assumed though (possibly incorrectly, but I digress) that the main audience of /. is made up of people not in those 2 categories. (note that I'm not saying there's anything wrong with people not knowing what sed is, just that most people on /. would probably have enough exposure to *nix to know.)

      If you want to know more about sed, look at the man page, available http://linux.ctyme.com/man/man2377.htm [ctyme.com]

      Also, for anyone who doesn't know/can't figure it out, man page is short for MANual page. If you have any access to a *nix system, I hope you know about man. For those that may not, the man pages are a wonderful help utility provided with linux systems to give information about various programs, commands, etc. A user simply types `man [commandname]` and up pops a helpful page telling all about the command or program. In our case, it would be `man sed`.

      Slightly on a tangent, does anyone know of a help system for *nix similar to the old DOS help system (which MS has so helpfully removed and replaced with that stupid paperclip/dog/whatever)? It was nice to be able to simply browse the available commands, jump from help page to help page, etc. A similar thing for *nix could be nice at times.

      For something more on topic... nice hack. From what little I've played with sed, I can't imagine having the patience to write a game with it. The only question I have is, why?
  • Yes, but... (Score:2, Funny)

    by wedg (145806)
    ...will it julianne fries?
  • Not bad (Score:2, Interesting)

    But dc.sed [inwind.it] takes some beating. Square roots with regexps anyone?

    (this is how it works [inwind.it])

  • Although admitedly this isn't on the topic of cool sed hacks...
    If you haven't heard of or tried it, [and like this sort of game], be sure to also look into
    rocksndiamonds [artsoft.org], a truly excellent game for X. It not only has all the classic sokoban levels, but it also does an excellent implementation of Boulderdash, and also Emerald Mine [which I have fond memories of wasting huge amounts of time with on my old Amiga when I was a kid]. Excellent graphics to boot. Plus it's GPL. I've always been suprised that redhat dosen't provide it as an rpm, considering some of the marginal games that they do ship.

      • Argh... Repton 2 was of course just pure evil. I never actually finished it. Must find it for my BBC emulator, Hmm... how to read 320K 5¼ floppies on a PC...
  • Sokoban in Nethack (Score:5, Informative)

    by 6R1MM (532936) on Thursday March 21 2002, @04:13AM (#3199082)
    I'd just like to point out that sokoban can be played inside nethack. It's actually a series of levels in the game called The Sokoban Tower. For those that don't know, nethack is an ASCII-based graphical RPG with movement controls inspired by vi.
    • And how! I was considering a facetious comment along the lines of "Hey, that looks like a nethack level..." but that would only work in a group of nethack players.

      Anyway, you left out the part about it being the best game in the world, etc. Diablo? Diablo is for people with short attention spans who like shiny graphics. Us hardcore gamers (with, er, 386s...) know where it's at. [/joking- play whatever you like, it's a theoretically free world]

      The curious ought to go to nethack.org [nethack.org] and give it a shot. If you're new and using DOS/Win, try the graphics version. But whatever the interface, the game is highly addictive.
    • There is a sokoban puzzle in the middle of the text adventure game, Zork II. If you think Sokoban is challenging with a top-view graphical representation, try it in first-person prose. All you see is "a sandstone wall on your west, a sandstone wall on your south, and a marble wall on your east" and all you can try is "push the west wall."

      Heck, when you first encounter it, you don't even know it's a Sokoban puzzle. You just find these goofy walls. It's only after carefully exploring and mapping the free and open areas and the wall materials that you might see your map as something else. Finally you can start working out on paper what you need to do.

      I played this on an Apple II, and it's still available in the Infocom collection. Heck, play it on your Palm Pilot.

    • For those that don't know, nethack is an ASCII-based graphical RPG with movement controls inspired by vi.

      To elaborate further, nethack is a latter-day version of hack, which in turn was a descendant of the original rogue [wichman.org]. (Which, as the man said, is an ASCII/curses based RPG.)
    • I thought I had it working forever ago, and I know I used to have it on console (but not xterm) with debian.


      Not that I've ever had a tendency to move into my cat or any such thing . . .


      anyone know how to do this?


      hawk, who still needs to file the bug report in freebsd for nethack being a port rather than the base system (but will face the mkdir/rmdir spelling error bug first!)

      • You xterm-happy kid :) I usually would point you to the documemtation, but since this is somewhat less-obvious, I'll point it out here for you. Stick it in your tool chest, impress your friends, go far away places, meet interesting people, and kill them (to stay a little bit on topic) ;)

        Right, enough silly banter. Pay attention:

        Try this: (in bourne shell derivatives)

        TERM-xterm-color && export TERM

        Or this: (if you use the csh dialect)

        setenv TERM xterm-color

        As you will notice, more apps will be in color now, like mutt et al... Oh, you can have your colored ls(1) too. Check google on how to set that up.

        • >You xterm-happy kid :)


          It's not my fault!


          The boss just won't spring for a 3x3 shelf of VT100's with a wrist-mount inertial switch to connect the keyboard, so I'm stuck with xterms, the *real* reason for using X.



          >I usually would point you to the documemtation,


          Been there, done that. TERM was already xterm-color. This now works, but it wasn't before. It may be that all the colors were used up (I have my drive in a loaner laptop, and only get 8 bit--and it's not worth hunting down an xf86config for the few days involved), or there may have bveen another funky interaction going on.


          But thanks.


          hawk

    • Sure you can play the Nethack with its original ASCII based interface, but the game is far more sexy with a full SVGA Diablo-esque interface (see screenshots on bottom of linked page) [www.hut.fi]. Note this game is fully open source, and still actively developed... even after more than a decade! This game has been polished to perfection.
  • I've found a use for Cygwin ;)
  • Tried it out (Score:2, Interesting)

    by tuxlove (316502)
    This is totally cool. Very creative. Reminds me of the Towers of Hanoi vi script I've seen floating around. Also the maze generator/solver in vi script. The vi scripts are cool because they use parts of the screen to store variables. :)
  • by po8 (187055) on Thursday March 21 2002, @04:33AM (#3199117)

    Consider the case of Andreas Junghanns, who wrote Rolling Stone, the world's top machine Sokoban solver [ualberta.ca], in C. I'm sure that even as you read this he is working on rewriting it in the Sokoban-friendly language sed.

    Or not.

  • by ct (85606) on Thursday March 21 2002, @04:57AM (#3199162) Homepage
    To quote Chris Rock in Bigger and Blacker [amazon.com],

    "Just because I can drive a car with my feet - doesn't make it a good fucking idea".

    //ct
  • Under OS X (Score:4, Interesting)

    by rjamestaylor (117847) <rjamestaylor@gmail.com> on Thursday March 21 2002, @05:01AM (#3199166) Homepage Journal
    It runs under OS X (no Aqua support though...kidding) BUT not using Darwin/BSD's sed (/usr/bin/sed), rather using Fink's sed (/sw/bin/sed). Using the default sed, I get this error:
    • sed: 2266: ./sokoban.sed: unexpected EOF (pending }'s)
    Once again, GNU tools rule over BSD tools. Well, for gaming, anyway.
  • Here's something I made a while back in case anyone's interested:

    Perltris [seanadams.com]

    • Yeah, I wrote Tetris [chrisbrien.co.uk] (and a few others) in JavaScript (for DOM level 1 browsers - Mozilla or IE5 will work) a while back. I also wrote Tetris [chrisbrien.co.uk]in C++ (source is here [chrisbrien.co.uk]; works under Wine) when I was learning DirectX. The blocks.js became blocks.h with a few search and replaces.

      So Tetris is kindof my "Hello World" when learning a new language. I don't think I'll try to write it in sed though. :o)
  • Is there such a thing as a sh-hof? In that case I would like to nominate the sed hack in the story, and this webserver written in postscript [pugo.org]... :)
  • Well, this seems as good a place as any to mention the sed script I wrote some 4 years ago that emulates a Turing machine. The script is actually capable of performing any calculation one can write a Turing machine program for... addition of two numbers is provided as an example.

    Oh, ofcourse, the sed Turing Machine [student.kun.nl] is on the web as well. :)

    Owh, by the way, it's pretty readable sed code... it's had to be for me to finish it. :)

    Arthur

  • Games for SED? Now I've seen everything. So what's next? Textmode quake 2 [slashdot.org]?
  • I'm impressed that it's possible in sed. Here's a smaller one, in perl [freeuk.net], but I dunno if it'll work on Win32.
  • that reminds me of the tetris game I played a while ago written in VIM's native scripting language. The tetris game is here [sourceforge.net] IIRC. Heh, and when I was looking for that there seems to be a sokoban game [sourceforge.net] in VIM too..
  • by Fluffy the Cat (29157) on Thursday March 21 2002, @08:35AM (#3199609) Homepage
    See http://www-jcsu.jesus.cam.ac.uk/~gsb29/sedgames.ht ml [cam.ac.uk] for sed versions of pong, noughts and crosses (tic tac toe in the US, I think), a webserver and a program for translating bf into C.
  • it's pretty cool nonethe less, though ... reminds me off the jezzball and pong clones i saw written in zcode, the language used for the original zork series and other text-adventure games ...
  • ...I think the slashdotting this guy received inspired him.

    When I went here [verde666.org] last night, there were two files, the .png screenshot and the original .sed script. Now there's 2 more versions out (0.0 and 0.1) and a contest to see who can solve each level in the fewest moves, along with a solution to level 1.

    Just in case all of you didn't bother to visit it, or didn't visit it twice, you should check it out: The contest makes for some fun gameplay.
    • I'm not sure how exactly you think switching to a Microsoft server platform will improve HTML standards conformance. Standards conformance has nothing to do with the platform serving the content, but the code which generates the HTML. Aside from that, this post is grossly _off-topic_.
    • by WWWWolf (2428)

      Hey, let's not be unfair. At least we Perl users have terminal control libraries [cpan.org] and something that looks like a programming language. Besides, using sed for "real" programming is hard and challenging and people stand in awe, but using Perl for real programming is just fun and no one notices if you program something infinitely cool with it, because Perl was made so that infinitely cool things could be made easily.

      This hack is impressive because it was made in a toothless environment, not because it has not yet been implemented in some better language =)