9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] sokoban
@ 2004-09-07  0:09 YAMANASHI Takeshi
  2004-09-07  0:13 ` andrey mirtchovski
  0 siblings, 1 reply; 7+ messages in thread
From: YAMANASHI Takeshi @ 2004-09-07  0:09 UTC (permalink / raw)
  To: 9fans

> it has 120 levels and is fully playable (much more so than the maze
> game)...

I, an idiot, am stuck on level 2. :(
-- 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] sokoban
  2004-09-07  0:09 [9fans] sokoban YAMANASHI Takeshi
@ 2004-09-07  0:13 ` andrey mirtchovski
  2004-09-07  0:34   ` Russ Cox
  0 siblings, 1 reply; 7+ messages in thread
From: andrey mirtchovski @ 2004-09-07  0:13 UTC (permalink / raw)
  To: 9fans

>> it has 120 levels and is fully playable (much more so than the maze
>> game)...
> 
> I, an idiot, am stuck on level 2. :(
> -- 

i think level 2 was wrong!  i was stuck on it too, but passed the next
few levels.  i've changed a single location to make it more trivial:

plan9% cat sokoban/levels/2
  ####
  #  #
### $####
#@$..   #
#  .* $ #
###  ####
  #  #
  ####
plan9% 

or you can just download the new one from the web.. the solution now is much easier.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] sokoban
  2004-09-07  0:13 ` andrey mirtchovski
@ 2004-09-07  0:34   ` Russ Cox
  2004-11-26 22:59     ` Axel Belinfante
  0 siblings, 1 reply; 7+ messages in thread
From: Russ Cox @ 2004-09-07  0:34 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

that's excellent!  i was going to suggest that.
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.

also i've been recently playing fish fillets
(http://fillets.sf.net), which is to sokoban as
chess is to go.

russ


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] sokoban
  2004-09-07  0:34   ` Russ Cox
@ 2004-11-26 22:59     ` Axel Belinfante
  2004-11-27 11:59       ` [9fans] namespace construction arisawa
  0 siblings, 1 reply; 7+ messages in thread
From: Axel Belinfante @ 2004-11-26 22:59 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [9fans] namespace construction
  2004-11-26 22:59     ` Axel Belinfante
@ 2004-11-27 11:59       ` arisawa
  2004-11-27 15:38         ` Heiko Dudzus
  2004-11-27 17:27         ` Russ Cox
  0 siblings, 2 replies; 7+ messages in thread
From: arisawa @ 2004-11-27 11:59 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

I have two questions on namespace construction.

1st:

Let alice executes:

void
main(int argc, char *argv[])
{
	rfork(RFCNAMEG);
	bind("#c", "/dev", MAFTER);
	execute("/boot/factotum", "factotum -n");
	print_owner("/mnt/factotum/ctl")
}

where execute() is fork + exec + wait
and print_owner prints file owner.

then the program will print "alice"
however if bind is commented out, it print "none"
Is this a specification ?


2nd:

we will find the line:
                 ai = fauth_proxy(afd, rpc, amount_getkey, "proto=p9any 
role=client");
in /sys/src/libauth/newns.c
note that user name is not specified here.
this can cause unexpected result.
for example, let factotum key for alice is:
	key proto=p9sk1 dom=aichi-u.ac.jp user=alice !password?
	key proto=p9sk1 dom=aichi-u.ac.jp user=bob !password?
then fauth_proxy will always get alice's key and constructs namespace
for alice even if alice want to be bob.
another example is:
if alice puts factotum keys into secstore
	key proto=p9sk1 dom=aichi-u.ac.jp user=bob !password?
	key proto=p9sk1 dom=aichi-u.ac.jp user=alice !password?
then alice will surprise to find that the namespace is not for alice.
why user is not specified in fauth_proxy ?

Kenji Arisawa



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] namespace construction
  2004-11-27 11:59       ` [9fans] namespace construction arisawa
@ 2004-11-27 15:38         ` Heiko Dudzus
  2004-11-27 17:27         ` Russ Cox
  1 sibling, 0 replies; 7+ messages in thread
From: Heiko Dudzus @ 2004-11-27 15:38 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

arisawa@ar.aichi-u.ac.jp wrote:
> Hello,
> 
> I have two questions on namespace construction.

"In-Reply-To" and "References" to posts about sokoban by accident?

Looks strange and confuses in threading mailreaders.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] namespace construction
  2004-11-27 11:59       ` [9fans] namespace construction arisawa
  2004-11-27 15:38         ` Heiko Dudzus
@ 2004-11-27 17:27         ` Russ Cox
  1 sibling, 0 replies; 7+ messages in thread
From: Russ Cox @ 2004-11-27 17:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> void
> main(int argc, char *argv[])
> {
>         rfork(RFCNAMEG);
>         bind("#c", "/dev", MAFTER);
>         execute("/boot/factotum", "factotum -n");
>         print_owner("/mnt/factotum/ctl")
> }
> 
> where execute() is fork + exec + wait
> and print_owner prints file owner.
> 
> then the program will print "alice"
> however if bind is commented out, it print "none"
> Is this a specification ?

Factotum reads /dev/user to learn its user name.

> 2nd:
> 
> we will find the line:
>                  ai = fauth_proxy(afd, rpc, amount_getkey, "proto=p9any
> role=client");
> in /sys/src/libauth/newns.c
> note that user name is not specified here.
> this can cause unexpected result.
> for example, let factotum key for alice is:
>         key proto=p9sk1 dom=aichi-u.ac.jp user=alice !password?
>         key proto=p9sk1 dom=aichi-u.ac.jp user=bob !password?
> then fauth_proxy will always get alice's key and constructs namespace
> for alice even if alice want to be bob.
> another example is:
> if alice puts factotum keys into secstore
>         key proto=p9sk1 dom=aichi-u.ac.jp user=bob !password?
>         key proto=p9sk1 dom=aichi-u.ac.jp user=alice !password?
> then alice will surprise to find that the namespace is not for alice.
> why user is not specified in fauth_proxy ?

The convention in Plan 9 is that the first usable key gets used.
If the user name had to be specified, then that would just be
one more thing to worry about that usually doesn't matter -- most
of the time there is exactly one key that works.  

If alice wants to be bob, she can set up a different factotum 
with bob's keys first or comment out her own key.

Not having to specify the user name means that I can mount file
systems from multiple systems, where I might be rsc, or rcox, or
russcox, or rscox2, or whatever else, without having to explicitly
tell newns about all of these.  Instead my factotum can fill in the
details.  It might be useful for users to be able to specify, on a
per mount basis, which key to use, but newns is not a per-user
thing -- that code sets up the name space for any user, not just
alice, using files in /lib, so there's no place to put special annotations
like "when I'm alice, use bob's key here."

Note that if you're using mount or cpu instead of newns then you
can use -k with a key pattern to specifiy a key.  For example,
mount -k 'user=bob' to force the mount to try only keys with
user=bob.

Russ


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-11-27 17:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-07  0:09 [9fans] sokoban YAMANASHI Takeshi
2004-09-07  0:13 ` andrey mirtchovski
2004-09-07  0:34   ` Russ Cox
2004-11-26 22:59     ` Axel Belinfante
2004-11-27 11:59       ` [9fans] namespace construction arisawa
2004-11-27 15:38         ` Heiko Dudzus
2004-11-27 17:27         ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).