Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Games Entertainment

SedSokoban 149

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."
This discussion has been archived. No new comments can be posted.

SedSokoban

Comments Filter:
  • 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&marnanel,org> 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.

    • Each command ('h' for left, for instance) is a string you have to enter into the game. It's a normal line input and you see what you're typing. Therefore you can also Backspace to remove unwanted commands before <Enter>ing them.
  • Here's a mirror of the screenshot.

    http://www.zianet.com/endikos/sedsokoban.png [zianet.com]
  • Okaaaay. (Score:1, Funny)

    by Scotch Game ( 442068 )

    Oh yeah? Well, I hack frickin' NT boxes with awk!

    No wait ... The sokoban thing is a lot harder.

    *****
    What would you do if you knew you could not fail?

    • I used to make huge adventuregames in the MS-DOS Batch-language, back in 91-93. Complete with ascii "graphics" and all..
      One of them even had a level-system where your character increased levels, all using the VERY limited batch variable system in connection with the choice.com thingie that became standard in MS-DOS 5 or 6. ...And batch is alot simpler and primitive than Sed. ;)

      Ofcourse, I vouldn't dream of even attempting to make anything like Sokoban in Batch. =)
  • First off, it is truly cool that it was able to be done. I'm a huge fan of accomplishing anything while using extraordinary and/or unusual means. The only drawback I feel is the resolution of game movement limited by the medium. Not the screen resolution, but the square grid that any kind of output in a text based grid has to conform to. Since any movement is limited to the eight nearest squares, games on order of a simple flash game probably cannot be acheived. Not the fault of the designer, just a drawback to the medium. Other than that, rock on!
  • 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&marnanel,org> 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/
      • This is a joke, right? Sed is a "DOS game writing app for windows XP?" Surely you jest.

        Sed is a unix command to manipulate text streams. similiar to "awk." It is kind of like a command-line "find and replace" function. Only better :)
        Perl is like a much more advanced, super-evolved, and uber-powerful version of sed.

        Let the man be your friend. "man sed" on almost any unix box (that includes MacOS X) will help you.
        Sed is not a windows XP command. (at least, unless MS copied unix here...). And Sed's purpose is most definately NOT writing DOS games. Or games of any kind. Which is what makes it cool that the guy coud write a game with it.
        • by anpe ( 217106 )
          Sure, it _was_ a joke, I wonder who modded it as "Informative" :-)
          • I believe some moderators did that. Dude, this is getting worse every day...

            "Great! Now tell me again that history about when you died".
      • 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.
    • Or you could just type in man sed and understand even more than most of us who at least know what sed is.
    • Re:Ummm....What? (Score:5, Informative)

      by marnanel ( 98063 ) <slashdot&marnanel,org> 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.
    • Quote from the story: "Have you ever thought that sed is too limited and only useful to Regular Expression scripts?"

      Maybe one could then assume that normally sed is used for regular expression scripts?

    • 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?
    • Thank you all so much for the info, I apologise for my newbieness ;) I'm not just a windows weenie, I have installed Mandrake, and I'm trying to learn.

      Thanks again for your understanding :)
  • i don't care what anybody says, i like sokoban more than i like donkey kong. the point? don't let hunger happen to you.
  • Yes, but... (Score:2, Funny)

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

    by John Ineson ( 538704 )
    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.

    • The original original this styly of game on the BBC micro.

      I remember the last incarnation "Repton Infinity" alowed you to even script objects and actions.
      But he had many adventures before that, "Repton through time", "Repton somthing or other ...." (I seem to have 4goten)

      Must have been at least 11 years ago !
      • 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.
    • by Ravagin ( 100668 )
      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.

        • Urgh.. of course that should be:

          TERM=xterm-color && export TERM

          for bourne compatible shells... (oh and btw, that 2 minute timeout on /. sucks)

        • >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 ;)
    • It does work, btw--with Cygwin, I mean. I played through a couple of levels on it last nite. Only weird thing--some of the levels have *'s in them and it seems to make those levels less/un-playable.
  • 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.

  • Now we are just waiting for someone to do an intercal [tuxedo.org] version of Sokoban.
  • 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) 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.
  • let's see those perl weenies do *this*!

    Tommorrow: Slashcode to be rewritten in sed.
    • 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 =)

  • Here's something I made a while back in case anyone's interested:

    Perltris [seanadams.com]

  • If sed provides the essential capabilities for programming such a game, it probably satisfies the criterion for being Turing complete [wikipedia.com]. It can be proven that any Turing-complete device can in principle do what any other Turing machine or computer can do.

    Hence, it is probably possible to write an processor emulator in sed which can run an operating system and any software that exists in that operating system. It would only be a bit slow.
  • 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

    • I just saw the spazioweb.inwind.it/seders website, and noticed that Christophe Blaess built a Turing machine emulator in sed as well last year... apparently there's more people as geeky as me.

      Anyway, his implementation has the number of characters the sed-implementation allows minus three as a limit on the total number of states in the Turing machine, which mine doesn't.

  • Games for SED? Now I've seen everything. So what's next? Textmode quake 2 [slashdot.org]?
  • include this game in the next version of their distro ?
  • 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.
  • by Anonymous Coward
    hi, i'm aurélio, the author of sedsokoban.
    thanks for all the comments, i'm very happy about
    them &:)
    the errors on Solaris it's because on your sed
    version, the branch command (b) must be the last
    thing on the line.
    just apply this sed command on the script and it
    will work:
    sed '/bx;}/{G;s/bx;}\(\n\)/bx\1}/;}'
  • This is sickest thing I've ever come across in my whole life. People (children even!) are suffering and dying from hunger in the world, and this guy wastes his time using sed as a programming platform for 2D action!

    Oh my god, how I love it! Pure genius! :-)
  • 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..
  • While I think that writing a game in sed is neat. I can't imagine putting that much effort into it. I guess I'm a slacker, I like to see the sun and interact with others.
  • I hope he programs a version of sedQuake next. Nothing like a happy face running around a screen shooting people with all those neato ascii characters. Oh the joy!
  • 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.
  • This is my first exposure to Sokoban and I'm already addicted.. well probably because it's hacked in sed. My 2 Eurocents on this game are that it's easier than it seems. Because in many games of this sort, you have to rely on other 'blocks' (or whatever they happen to be) to utilize others, so you have to plan things carefully. But in Sokoban, it seems, other blocks are simply on your way, and it's best to get the easy ones first. Or can someone prove me wrong?
  • If you really want to see how sick programmers spend their time, surf over to The Obfuscated C Contest [ioccc.org]. It has been going on for years, I used to try it back in the 80's, but I was not sick enough! LOL!

    Check out the archives and try to compile the winners and at last run the result for both amazement and amusement.

    Good Luck!

    Oh, the SED Sokoban was neat, but I lost interest after 8 moves... So much for your work...
  • My first question would have to be.. WHY man...WHY??? Fantastic work but.... WHY???? I patiently await your sed-driven text version of quake 3 arena
  • 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 didn't notice any solution scripts for the game so I whacked together a level 1 script. You can find it at:

    Level 1 [worldsinfinite.com]

    Just save the file and use it as stdin for the game and watch the little '@' go! Does anyone else had cheats like this for the game?
  • I would like to mirror the image for you is there any way that i could ... e-mail me shadow_walker@prodigy.net thanks c3
  • ...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.

Real programmers don't comment their code. It was hard to write, it should be hard to understand.

Working...