[Edu-sig] more card play

kirby urner kirby.urner at gmail.com
Tue Nov 3 18:37:53 CET 2009


On Mon, Nov 2, 2009 at 10:20 PM, Laura Creighton <lac at openend.se> wrote:
> In a message of Mon, 02 Nov 2009 20:27:35 PST, Edward Cherlin writes:
>>Cards: You are right on the merits for combinatory math, but you will
>>run into strong cultural aversions.
>
> Why?  Especially when _dice_ seem to be the preferred way to teach
> this stuff?  (Or is this only here?)
>
> Laura
>

Yeah, dice are the perfect math object in that they unify polyhedra
and randomness (chaotic sequences) in a single artifact.

That we have all the Platonic solids as dice these days is a cool
development, suitable for translating into software.[0]

from random import choice

class Die:
        def __init__(self, number_of_sides = 6):
            self.facets = number_of_sides
        def roll(self):
            return choice(range(1, self.facets+ 1))  # eliminate 0
        def __str__(self):
            return "{0} sided die".format(self.facets)
        def __repr__(self):
            return "Die({0})".format(self.facets)

>>> thedie = Die(20)
>>> thedie.roll()
14
>>> thedie.roll()
10
>>> thedie.roll()
7
>>> thedie
Die(20)
>>> str(thedie)
'20 sided die'

Here's a more complicated version (not by me) that rolls a sum as
triggered by the __rmul__ rib.
http://code.activestate.com/recipes/573437/

Of course it might make a lot more sense to write this as a two line
generator, could then go roll = next to assign the next keyword
another name.

>>> from random import randint

>>> def die(sides):
	while True:  yield randint(1, sides)
		
>>> icosa_die = die(20)
>>> roll = next
>>> roll(icosa_die)
10
>>> roll(icosa_die)
18
>>> roll(icosa_die)
8
>>> roll(icosa_die)
4

Speaking of Open Education standards, the Boston Globe is finally
getting into print what many have seen as the writing on the wall:
mass published wood pulp textbooks are taking a back seat to digital
distribution mechanisms.[1]

USG stimulus money is helping to fuel the transition, ironically by
funding proprietary initiatives versus creating more FOSS of by and
for the people.

Also ironic is the fact that use US military is a leading proponent of
FOSS [2] given its already socialized mindset (i.e. its assets are
communally owned and operated).[3]

The White House recently switched to Drupal in a symbolic gesture.

Kirby

[0] http://www.dice.co.uk/poly_re.htm
[1] http://mybizmo.blogspot.com/2009/11/not-following-detroit.html
[2] http://controlroom.blogspot.com/2009/10/open-source-dot-gov.html
[3] http://controlroom.blogspot.com/2009/11/socialist-victory-satire.html


More information about the Edu-sig mailing list