[gcompris-devel] new activity : melody
Bruno Coudoin
bruno.coudoin at free.fr
Mon Dec 15 13:37:03 UTC 2003
Le lun 15/12/2003 à 21:13, José JORGE a écrit :
> hi,
>
> I just started, one sound board.
> For now it is only a "discover thing" : click on things to play sounds.
> An archive is joined with the files. I don't know how to integrate it in the
> CVS.
> I provide it if someone has an more kiddy idea for the theme : for now it is
> only a kitchen simulator.
>
> I plan to make a goal to the activity by asking to repeat a sound sequence, as
> soon as I manage to do it in python.
>
> Anyway, thanks Olivier for the binding, now I love python ;-)
>
Your activity is great. Congratulation. It's simple but funny and I am
sure it will be educational once completed.
For an example of code to implement the repeat, here is the python code
that could does it.
a=[]
# Each time the user click on an item, add it to the list
a.append("sa")
# You end up having a list of the kind
a=["sa", "sb", "sc"]
# When the list is longer than the sound length to find fifo on item
a.pop(0)
# You will get
['sb', 'sc', 'sa']
# Let's say you saved the solution to find in solution
solution=['sb', 'sc', 'sa']
# Simply check both list are equals:
if(solution==a)
print "found it"
else:
print "you loose"
I have commited your code (I didn't get the board icon). To run it, use
gcompris -d 0 to display uncomplete boards.
Hope it helps.
More information about the Gcompris-devel
mailing list