Re: [SoaS] Pippy - SoaS v10 TC5 tests with important activities INCLUDED in the standard distribution
Put a new Pippy-54.xo on people.sugarlabs.org/walter * copy/paste is fixed * Jean's new Life code in place * a few tweaks to the tutorials -walter On Sun, Dec 15, 2013 at 1:35 PM, Jean THIERY jean.thi...@modlibre.info wrote: Hello, Le 14/12/2013 16:10, Walter Bender a écrit : Please test using http://people.sugarlabs.org/walter/Pippy-54.xo Thank you for this new version well adapted to developments. NB 1: Paste [^V] don't seem to work so it is not possible to test Copy [^C]. NB 2: There are still problems with sound examples but I have to load TamTam ! I think the sound examples should all work, as long as TamTam is installed and working. Answer in a future message. Life seems to work but classical figures do not appear : - no stable squares, - no oscillating bars, - ... NB 3: Life seems to work now : see the attached file tested on Sugar TC5 with Pippy-54.xo http://alt.fedoraproject.org/pub/alt/stage/20-TC5/Live/i386/ and on DrPython (Ubuntu Linux) http://drpython.sourceforge.net/ Now, classical figures do appear - stable squares, pentagons, hexagons, ... - oscillating bars, ... The problem is not a problem between Python and Sugar but a problem within the Python program, probably when counting nearest neighbors. I hope to be able to analyze this problem on Saturday or Sunday. The problem was a Python problem. Main changes : *DrawGrid* displays the number of neighbors of living cells. This is useful for tests but can be reversed later on. *CountNeighbors* has been changed for proper counts. *Iteraction* : the current grid is saved in grid0 since neighbors should be counted in the initial grid. The grid is now rectangular for a larger display. The width/height ratio should be adapted on the last line. thanks. regards. -walter Sincerely hours, Jean [Jean.Thiery(ò)ModLibre.info][http://ModLibre.info/] -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ SoaS mailing list SoaS@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/soas
Re: [SoaS] Pippy - SoaS v10 TC5 tests with important activities INCLUDED in the standard distribution
Hello, Le 14/12/2013 16:10, Walter Bender a écrit : Please test using http://people.sugarlabs.org/walter/Pippy-54.xo Thank you for this new version well adapted to developments. NB 1: Paste [^V] don't seem to work so it is not possible to test Copy [^C]. NB 2: There are still problems with sound examples but I have to load TamTam ! I think the sound examples should all work, as long as TamTam is installed and working. Answer in a future message. Life seems to work but classical figures do not appear : - no stable squares, - no oscillating bars, - ... NB 3: Life seems to work now : see the attached file tested on Sugar TC5 with Pippy-54.xo http://alt.fedoraproject.org/pub/alt/stage/20-TC5/Live/i386/ and on DrPython (Ubuntu Linux) http://drpython.sourceforge.net/ Now, classical figures do appear - stable squares, pentagons, hexagons, ... - oscillating bars, ... The problem is not a problem between Python and Sugar but a problem within the Python program, probably when counting nearest neighbors. I hope to be able to analyze this problem on Saturday or Sunday. The problem was a Python problem. Main changes : *DrawGrid* displays the number of neighbors of living cells. This is useful for tests but can be reversed later on. *CountNeighbors* has been changed for proper counts. *Iteraction* : the current grid is saved in grid0 since neighbors should be counted in the initial grid. The grid is now rectangular for a larger display. The width/height ratio should be adapted on the last line. thanks. regards. -walter Sincerely hours, Jean [Jean.Thiery(ò)ModLibre.info][http://ModLibre.info/] # -*- coding: utf-8 -*- # This is the game life http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life import os import time import random def LoadCells(rows, cols): We need a function to load cells in the neighborhood grid = [] col = [0] * cols # first we load an empty grid for i in range(rows): col = [0] * cols grid.append(col) # then we load some cells for x in range(rows): for y in range(cols): cell = random.randint(0, random.randint(0, 1)) grid[x][y] = cell return grid def DrawGrid(grid): Here we draw the grid Test: Print the number of neighbors of living cells rows = len(grid) cols = len(grid[1]) # print rows, cols for x in range(rows): for y in range(cols): if grid[x][y] != 1: print '.', else: neighbors = CountNeighbors(grid, x, y) print chr(neighbors+48), # print 'o', print '\n', def CountNeighbors(grid, x, y): Count neighbors arround a single cell neighbors = 0 rows = len(grid) cols = len(grid[1]) # if x (rows - 1) and grid[x + 1][y] == 1: # neighbors += 1 # if x 0 and grid[x - 1][y] == 1: # neighbors += 1 # if y (cols - 1) and grid[x][y + 1] == 1: # neighbors += 1 # if y 0 and grid[x][y - 1] == 1: # neighbors += 1 # if x (rows - 1) and y (cols - 1) and grid[x + 1][y + 1] == 1: # neighbors += 1 # if x 0 and y 0 and grid[x - 1][y - 1] == 1: # neighbors += 1 # if x 0 and y (cols - 1) and grid[x - 1][y + 1] == 1: # neighbors += 1 # if x (rows - 1) and y 0 and grid[x + 1][y - 1] == 1: # neighbors += 1 neighbors += grid[(x+rows-1) % rows][(y+cols-1) % cols] neighbors += grid[(x+rows-1) % rows][ y ] neighbors += grid[(x+rows-1) % rows][(y +1) % cols] neighbors += grid[ x ][(y+cols-1) % cols] # neighbors += grid[ x ][ y ] neighbors += grid[ x ][(y +1) % cols] neighbors += grid[(x +1) % rows][(y+cols-1) % cols] neighbors += grid[(x +1) % rows][ y ] neighbors += grid[(x +1) % rows][(y +1) % cols] return neighbors def Iteration(grid): here we define a single iteration : # if we have between 3 and 6 neighbors the single cell lives # in other case the cell dies If a living cell has 2 or 3 neighbors, it survives in other cases it dies. A dead cell with 3 neighbors will become alive. rows = len(grid) cols = len(grid[1]) # grid0 = grid # Save the original grid for proper counts grid0 = [] col = [0] * cols # First we load an empty grid for x in range(rows): col = [0] * cols grid0.append(col) for x in range(rows): for y in range(cols): cell = grid[x][y] grid0[x][y] = cell # neighbors = 0 for x in range(rows): for y in range(cols): neighbors = CountNeighbors(grid0, x, y) if grid0[x][y] == 1: if neighbors 2 or neighbors 3: grid[x][y] = 0 else: if neighbors == 3:
Re: [SoaS] Pippy - SoaS v10 TC5 tests with important activities INCLUDED in the standard distribution
Please test using http://people.sugarlabs.org/walter/Pippy-54.xo regards. -walter On Fri, Dec 13, 2013 at 12:59 PM, Jean THIERY jean.thi...@modlibre.info wrote: Le 12/12/2013 23:13, Walter Bender a écrit : On Thu, Dec 12, 2013 at 12:15 PM, Jean THIERY jean.thi...@modlibre.info wrote: Le 12/12/2013 13:56, Walter Bender a écrit : ... Yes. Although I need to clean up the code included with Pippy. (A new Pippy will be released soon as well.) Thank you for this future Pippy version. Could you test http://people.sugarlabs.org/walter/Pippy-51.xo ? I will do it during the week-end because I cannot do it presently. On Sat, 07 Dec 2013 23:43:31 +0100 jean.thi...@modlibre.info wrote pippy-53 seems to work [ok] in general *but has PROBLEMS with some Python examples* *such as Life and ALL sounds* I think the sound examples should all work, as long as TamTam is installed and working. For *sounds* there are messages such as « NameError: global name '...' is not defined » For *Life* there is an old problem probably due to boundary conditions i.e, problems in matrix indexes. I couldn't find any problem with Life. Could you explain in more detail the problem? Life seems to work but classical figures do not appear : - no stable squares, - no oscillating bars, - ... The problem is not a problem between Python and Sugar but a problem within the Python program, probably when counting nearest neighbors. I hope to be able to analyze this problem on Saturday or Sunday. thanks. regards. -walter Sincerely hours, Jean [Jean.Thiery(ò)ModLibre.info][http://ModLibre.info/] -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ SoaS mailing list SoaS@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/soas
Re: [SoaS] Pippy - SoaS v10 TC5 tests with important activities INCLUDED in the standard distribution
[Axul-bureau][Axul-debats][Axul-linux] Merci pour votre message recopié ci-dessous avec quelques réponses. A bientôt sur Internet, Jean Thiéry [Jean.Thiery(ò)ModLibre.info][http://ModLibre.info/] Membre d'OLPC-France [http://olpc-france.org/wiki/] Membre de l'Aful [http://www.aful.org/] Secrétaire de l'Axul [http://www.axul.org/] Secrétaire de la SFBT [http://www.sfbt.org/] === Message original === === Message antérieur == Le 12/12/2013 13:56, Walter Bender a écrit : On Thu, Dec 12, 2013 at 7:48 AM, Jean THIERY jean.thi...@modlibre.info wrote: Hello, Le 12/12/2013 05:14, Frederick Grose a écrit : ... There is also a *Physics Python program* in Pippy. A simple display with no apparent interactivity (and no hand). Do they use common tools ? Yes. Although I need to clean up the code included with Pippy. (A new Pippy will be released soon as well.) Thank you for this future Pippy version. On Sat, 07 Dec 2013 23:43:31 +0100 jean.thi...@modlibre.info wrote pippy-53 seems to work [ok] in general *but has PROBLEMS with some Python examples* *such as Life and ALL sounds* For *sounds* there are messages such as « NameError: global name '...' is not defined » For *Life* there is an old problem probably due to boundary conditions i.e, problems in matrix indexes. I hope to be able to analyze this index problem on Saturday or Sunday. regards. -walter Sincerely hours, Jean [Jean.Thiery(ò)ModLibre.info][http://ModLibre.info/] ___ SoaS mailing list SoaS@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/soas
Re: [SoaS] Pippy - SoaS v10 TC5 tests with important activities INCLUDED in the standard distribution
On Thu, Dec 12, 2013 at 12:15 PM, Jean THIERY jean.thi...@modlibre.info wrote: [Axul-bureau][Axul-debats][Axul-linux] Merci pour votre message recopié ci-dessous avec quelques réponses. A bientôt sur Internet, Jean Thiéry [Jean.Thiery(ò)ModLibre.info][http://ModLibre.info/] Membre d'OLPC-France [http://olpc-france.org/wiki/] Membre de l'Aful [http://www.aful.org/] Secrétaire de l'Axul [http://www.axul.org/] Secrétaire de la SFBT [http://www.sfbt.org/] === Message original === === Message antérieur == Le 12/12/2013 13:56, Walter Bender a écrit : On Thu, Dec 12, 2013 at 7:48 AM, Jean THIERY jean.thi...@modlibre.info wrote: Hello, Le 12/12/2013 05:14, Frederick Grose a écrit : ... There is also a *Physics Python program* in Pippy. A simple display with no apparent interactivity (and no hand). Do they use common tools ? Yes. Although I need to clean up the code included with Pippy. (A new Pippy will be released soon as well.) Thank you for this future Pippy version. Could you test http://people.sugarlabs.org/walter/Pippy-51.xo ? On Sat, 07 Dec 2013 23:43:31 +0100 jean.thi...@modlibre.info wrote pippy-53 seems to work [ok] in general *but has PROBLEMS with some Python examples* *such as Life and ALL sounds* I think the sound examples should all work, as long as TamTam is installed and working. For *sounds* there are messages such as « NameError: global name '...' is not defined » For *Life* there is an old problem probably due to boundary conditions i.e, problems in matrix indexes. I couldn't find any problem with Life. Could you explain in more detail the problem? I hope to be able to analyze this index problem on Saturday or Sunday. thanks. regards. -walter Sincerely hours, Jean [Jean.Thiery(ò)ModLibre.info][http://ModLibre.info/] -walter -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ SoaS mailing list SoaS@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/soas