|
Size: 5526
Comment:
|
Size: 5535
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 15: | Line 15: |
| {{{ | {{{#!sagecell |
| Line 30: | Line 30: |
| print "<html><h1 align=center>Zeros</h1></html>" print "<html><h2 align=center><font color='blue'>How many zeros?</font></h2></html>" |
html("<h1 align=center>Zeros</h1>") html("<h2 align=center><font color='blue'>How many zeros?</font></h2>") |
| Line 34: | Line 34: |
| def zeros(a=("",selector(buttons=True, nrows=1, values=['Reset'] + [1..B], default=1))): | def zeros(a=selector(buttons=True, nrows=1, values=['Reset'] + [1..B], default=1)): |
| Line 37: | Line 37: |
| print "<html><center>" | html("<center>") |
| Line 41: | Line 41: |
| print "<font size=+3 color='red'>RIGHT</font>" | html("<font size=+3 color='red'>RIGHT</font>") |
| Line 54: | Line 54: |
| print "<font size=+2 color='blue'>Wrong. Try again...</font>" print "</center>" print "<font size=+%s color='#333'>"%random.randrange(-2,5) |
html("<font size=+2 color='blue'>Wrong. Try again...</font>") html("</center>") html("<font size=+%s color='#333'>"%random.randrange(-2,5)) |
| Line 58: | Line 58: |
| print "</font>" | html("</font>") |
| Line 60: | Line 60: |
| print "<br><br><center>Score: %s rounds, Average time: %.1f seconds</center>"%( round, float(tm)/round) print "</html>" |
html("<br><br><center>Score: %s rounds, Average time: %.1f seconds</center>"%( round, float(tm)/round)) |
| Line 68: | Line 67: |
| {{{ | {{{#!sagecell |
| Line 81: | Line 80: |
| queens.remove(queen) | if queen in queens: queens.remove(queen) |
| Line 101: | Line 101: |
| show(matrix_plot(board, cmap='Oranges' )) |
show(matrix_plot(board, cmap='Oranges' )) |
| Line 109: | Line 108: |
| {{{ | {{{#!sagecell |
| Line 135: | Line 134: |
| {{{ | {{{#!sagecell |
Sage Interactions - Games and Diversions
goto interact main page
Zeros
Have you ever wished you could count the number of zero digits in a long number like Rainman?
by William Stein and Sequoia Lefthand
Queens on board
An interaction to play with the problem of placing eight queens on a board so that they do not threaten each other. This interaction exemplifies the use of persistent data, and the auto_update=False option coded by mhansen and included in sage 3.3. by Pablo Angulo
Nim
Play nim against a perfect opponent. This interaction exemplifies the use of persistent data, and the auto_update=False option coded by mhansen and included in sage 3.3. by Pablo Angulo
