From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200411262259.iAQMxj920959@zamenhof.cs.utwente.nl> To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] sokoban In-reply-to: Your message of "Mon, 06 Sep 2004 20:34:51 -0400." References: <6dbd1b06e8bd4108e89b29d6e692b81f@plan9.ucalgary.ca> From: Axel Belinfante MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20953.1101509984.1@zamenhof.cs.utwente.nl.cs.utwente.nl> Date: Fri, 26 Nov 2004 23:59:44 +0100 Topicbox-Message-UUID: 0d07fa24-eace-11e9-9e20-41e7f4b1d025 A while ago Russ suggested: > a really nice addition is that you click on a ball > and a desitnation square, and if glenda can move > the ball there without touching any others, she > does so automatically. it's a lot nicer than the > "click one square at a time" once you get to > higher levels. i may add that later if no one beats > me to it. the search is not completely trivial, > but not so hard. at http://plan9.cs.utwente.nl/sokobanupd.tgz you will now find something that might be seen as a first step towards that, although slightly different in nature. If you click on a destination square then the following may happen: If - the destination square is on the same row or column as glenda, and - there is a ball next to glenda (in the direction of the destination square), and - all squares between the ball and the destination square (where glenda will move) are empty, and - the square next to the destination square where glenda will push the ball is empty too, then glenda will move to the destination square, pushing the ball while moving. Otherwise, if glenda can go to the destination square without touching anything, it will do so. Otherwise, nothing will happen. I found this working pretty well, although sometimes I do not get what I want (a 'push' instead of a 'walk' or the other way around). Russ' suggestion may work better in practice (but I only looked up his suggestion to type this message - after my hacking was already kind of completed). The search algorithm is pretty simplistic; it can be seen in action by toggling the 'animate' entry in the button 3 menu. 'noanimate' disables animation. The .tgz file contains an updated version of the files in /sys/src/games/sokoban - this seemed easier than providing it as a diff or patch - just unpack in a new directory, mk and run the result. there are small changes in sokoban.[ch] and mkfile, the multi-step stuff is in new file route.c. If it is seen as an improvement, integration in any form with the version on sources would be fine with me. Enjoy! Axel.