[Etoys] [ANNOUNCE] FreeCell activity
Bert Freudenberg
bert at freudenbergs.de
Wed Mar 11 13:08:49 EDT 2009
On 10.03.2009, at 23:49, karl ramberg wrote:
> On 3/10/09, Bert Freudenberg <bert at freudenbergs.de> wrote:
>>
>> http://activities.sugarlabs.org/en-US/sugar/addon/4054
>
> There are some rough edges, so here is a few suggestions:
>
> 1 disable halos, menus and lock background so it cant be picked up.
> 2 Help window and statistics window without menu, collapse and
> fullscreen button.
> 3 The pick-game-fill-in-the-blank got accepted as a drop into the
> playfield when I tried to move it.
>
> There is also a issue I have seen before in Free cell and that is when
> moving a bunch of cards, sometimes you can pick up many, sometimes
> not. Maybe there is a rule to how many cards can be moved ????
Well, one could argue that if you play this with real cards, you can
do this, too. You're only cheating yourself ;)
But you are welcome to contribute:
http://git.sugarlabs.org/projects/freecell/
Fixes to the game logic should go in a new etoys release. Improvements
to the Sugar activity should be made in gitorious:
http://sugarlabs.org/go/ActivityTeam/GitFAQ
One obvious next step would be to save something to the Journal. Using
the DBus Datastore API directly is a bit more cumbersome than
necessary (e.g., the datastore does not fill in timestamps, but the
Python toolkit breaks if there is no time stamp).
I was going to write a message about how cumbersome it is to use the
datastore, like how a simple 3 liner (open file, append log entry,
close file) becomes a 20-line program, but at least for now we have to
live with that anyway. If you are interested, I attached a snippet
demonstrating that file logging, using the Journal if running in Sugar.
- Bert -
-------------- next part --------------
| fileName myFile journal metaData existing utf8Name |
fileName := 'myFile.txt'.
myFile := FileStream fileNamed: fileName.
SugarLauncher isRunningInSugar ifTrue: [
journal := SugarDataStore new.
metaData := {'title'->fileName. 'mime_type'->'text/plain'} as: Dictionary.
existing := (journal find: metaData with: #()) first.
existing isEmpty ifFalse: [
metaData := existing first.
utf8Name := journal getFilename: (metaData at: 'uid') asString.
myFile nextPutAll: (FileStream readOnlyFileNamed: utf8Name utf8ToSqueak) contentsOfEntireFile.
FileDirectory default deleteFileNamed: utf8Name utf8ToSqueak]].
myFile setToEnd.
myFile cr.
myFile nextPutAll: 'Hello'.
myFile tab.
myFile print: Time now.
myFile close.
SugarLauncher isRunningInSugar ifTrue: [
utf8Name := (FileDirectory default fullNameFor: fileName) squeakToUtf8.
metaData at: 'timestamp' put: DateAndTime now asUnixTime.
metaData at: 'mtime' put: (DateAndTime now asString first: 19).
existing isEmpty
ifTrue: [journal create: metaData with: utf8Name with: false]
ifFalse: [journal update: (metaData at: 'uid') with: metaData with: utf8Name with: false].
FileDirectory default deleteFileNamed: fileName].
More information about the etoys-dev
mailing list