Potluck dish -- a game

2014-02-18 Thread Panicz Maciej Godek
Hi,
sorry that it took so long, but my friend Drcz wrote a clone of
Pandora game in Guile using my SLAYER framework. Due to some
difficulties of a technical nature, I only managed to set up the
website today, so now the screens are available here:
http://puszcza.gnu.org.ua/software/slayer/?page=screenshots

Maybe it's two days after the deadline, but I ensure that the dish is
still hot&fresh :)

Bon appetit!



Re: Potluck dish -- a game

2014-02-18 Thread Thompson, David
On Tue, Feb 18, 2014 at 3:53 AM, Panicz Maciej Godek
 wrote:
> Hi,
> sorry that it took so long, but my friend Drcz wrote a clone of
> Pandora game in Guile using my SLAYER framework. Due to some
> difficulties of a technical nature, I only managed to set up the
> website today, so now the screens are available here:
> http://puszcza.gnu.org.ua/software/slayer/?page=screenshots

Cool!  Thanks for sharing.  Care to explain a bit about the monoid
code?  I'm interested in monads as applied to games.

- Dave



Re: Problem with ftw from (ice-9 ftw)

2014-02-18 Thread Ludovic Courtès
Hello,

Frank Terbeck  skribis:

> [snip]
> % ls -ladn .
> drwx-- 11 1000 1000 4096 Feb 18 00:53 .
> [snap]
>
> In that directory and as root, I'm doing the following at guile's REPL:
>
> [snip]
> scheme@(guile-user)> (use-modules (ice-9 ftw))
> scheme@(guile-user)> (format #t "UID: ~d, EUID: ~d~%" (getuid) (geteuid))
> UID: 0, EUID: 0
> $1 = #t
> scheme@(guile-user)> (ftw "." (lambda (name stat flag)
> (format #t "~s: ~s~%" name flag)))
> ".": directory-not-readable
> $2 = #t
> [snap]
>
> The code treats root like a normal user, disregarding the fact that this
> particular users will be able to access any file or directory no matter
> the ownership or mode.

Indeed, that’s a bug.  I believe this is fixed with this patch:

diff --git a/module/ice-9/ftw.scm b/module/ice-9/ftw.scm
index 9c9694f..133e9c9 100644
--- a/module/ice-9/ftw.scm
+++ b/module/ice-9/ftw.scm
@@ -259,7 +259,8 @@
   (let* ((perms (stat:perms s))
  (perms-bit-set? (lambda (mask)
(not (= 0 (logand mask perms))
-(or (and (= uid (stat:uid s))
+(or (zero? uid)
+(and (= uid (stat:uid s))
  (perms-bit-set? #o400))
 (and (= gid (stat:gid s))
  (perms-bit-set? #o040))

However, that ‘ftw’ tries to do permission checks by itself is really a
flaw in the first place, IMO.

> Indeed, the ‘scandir’ routine from the same module will read the
> contents of that directory just fine.

I would recommend using ‘scandir’ or ‘file-system-fold’ from (ice-9 ftw)
for new code.

Thanks,
Ludo’.


Re: Potluck, midi -> chiptune

2014-02-18 Thread Ludovic Courtès
Hi!

Mike Gran  skribis:

> For this year's potluck, I wrote prog that converts a MIDI file
> into an 8-bit-era chiptune, such as might have been rendered by
> a Game Boy or SNES.
>
>
> It is here:
>
>   https://github.com/spk121/furry-nemesis

Neat!

I confirm it does the job (and does it CPU-intensively ;-)).  I’m
impressed that this can be done in so few lines of code actually.

Thanks!

Ludo’.




Re: Problem with ftw from (ice-9 ftw)

2014-02-18 Thread Frank Terbeck
Ludovic Courtès wrote:
> Frank Terbeck  skribis:
[...]
>> The code treats root like a normal user, disregarding the fact that this
>> particular users will be able to access any file or directory no matter
>> the ownership or mode.
>
> Indeed, that’s a bug.  I believe this is fixed with this patch:
[...]

Yes, that patch fixes the problem.

> However, that ‘ftw’ tries to do permission checks by itself is really a
> flaw in the first place, IMO.

Agreed.

>> Indeed, the ‘scandir’ routine from the same module will read the
>> contents of that directory just fine.
>
> I would recommend using ‘scandir’ or ‘file-system-fold’ from (ice-9 ftw)
> for new code.

Thanks. I'll probably rewrite it using ‘file-system-fold’.


Regards, Frank



Re: Potluck dish -- a game

2014-02-18 Thread Panicz Maciej Godek
2014-02-18 23:01 GMT+01:00 Ścisław Dercz :
> Hi!
>
> Actually it's not "a clone of Pandora game", the game is called "pandora"
> and it is "a chimera-alike".

Please forgive my ignorance, I wouldn't be me if I didn't mess everything up :)
I'll fix the info on the website ASAP!

> The monoid... I wanted to write the mechanics in a purely functional style,
> and the obvious choice was to describe it as a couple of world->world
> transformations;

BTW the SLAYER repository is also honored to host a purely functional
Snake game, originally written by Jens Nicolay and adjusted by the
humble me to work with SLAYER:
http://hg.gnu.org.ua/hgweb/slayer/file/24ecd3bc2709/demos/snake.scm

M.



Re: Potluck dish -- a game

2014-02-18 Thread Mateusz Kowalczyk
On 18/02/14 18:27, Thompson, David wrote:
> On Tue, Feb 18, 2014 at 3:53 AM, Panicz Maciej Godek
>  wrote:
>> Hi,
>> sorry that it took so long, but my friend Drcz wrote a clone of
>> Pandora game in Guile using my SLAYER framework. Due to some
>> difficulties of a technical nature, I only managed to set up the
>> website today, so now the screens are available here:
>> http://puszcza.gnu.org.ua/software/slayer/?page=screenshots
> 
> Cool!  Thanks for sharing.  Care to explain a bit about the monoid
> code?  I'm interested in monads as applied to games.
> 
> - Dave
> 

I'm also interested where the monoid is meant to be because the identity
and compose functions right after the comment don't form one: bah,
monoids don't admit an identity operation, just an identity element.

I'm also a bit confused about Dave's mention of monad straight away
afterwards: there doesn't seem to be one used anywhere I look at the
source (although I'm not looking that hard). Is it a mistake or am I
missing something? Did you check out some sources from [1]? Those ought
to satisfy your interest to some degree.

Thanks

PS: There seem to be comments here and there in Polish with broken encoding.

[1]: http://www.haskell.org/haskellwiki/Applications_and_libraries/Games


-- 
Mateusz K.



Re: Potluck dish -- a game

2014-02-18 Thread Ścisław Dercz
Dnia 18 lutego 2014 19:27 "Thompson, David"  
napisał(a):

> On Tue, Feb 18, 2014 at 3:53 AM, Panicz Maciej Godek
>  wrote:
> > Hi,
> > sorry that it took so long, but my friend Drcz wrote a clone of
> > Pandora game in Guile using my SLAYER framework. Due to some
> > difficulties of a technical nature, I only managed to set up the
> > website today, so now the screens are available here:
> > http://puszcza.gnu.org.ua/software/slayer/?page=screenshots
> 
> Cool!  Thanks for sharing.  Care to explain a bit about the monoid
> code?  I'm interested in monads as applied to games.
> 
> - Dave
> 

Hi!
 
Actually it's not "a clone of Pandora game", the game is called "pandora"
and it is "a chimera-alike".
The monoid... I wanted to write the mechanics in a purely functional style,
and the obvious choice was to describe it as a couple of world->world
transformations; these in turn form a monoid under the composition action
(and with identity map as unit).
That's all, unfortunately it does not have much to do with monads per se...
or does it? I'm an categorial ignorant!

Cheers,
d.