[Edu-sig] Sample Data Structure

Gregor Lingl glingl at aon.at
Mon Jun 26 16:55:23 CEST 2006


kirby urner schrieb:
> So here'd be a rich data structure transcribed from Math World:
> http://mathworld.wolfram.com/news/2003-11-18/magiccube/
>
> Possible lesson plan:  use as mapped and indexed data structure to
> verify we're meeting the requisite criteria for a perfect magic cube
> of edges 5 cells.
>
> magic5 = dict (
>
>     square0 =
>     [[25, 16, 80, 104, 90],
>     [115, 98, 4, 1, 97],
>     [42, 111, 85, 2, 75],
>     [66, 72, 27, 102, 48],
>     [67, 18, 119, 106, 5]],
>
>   

I doubt if it is a good choice to use a dictionary here, as this is not 
an ordered data
structure and interchanging the layers of  the cube will certainly make 
the cube
imperfect.

I suppose a 5 element list would be more appropriate.

Regards
Gregor


>     square1 =
>     [[91, 77, 71, 6, 70],
>      [52, 64, 117, 69, 13],
>      [30, 118, 21, 123, 23],
>      [26, 39, 92, 44, 114],
>      [116, 17, 14, 73, 95]],
>
>     square2 =
>     [[47, 61, 45, 76, 86],
>      [107, 43, 38, 33, 94],
>      [89, 68, 63, 58, 37],
>      [32, 93, 88, 83, 19],
>      [40, 50, 81, 65, 79]],
>
>     square3 =
>     [[31, 53, 112, 109, 10],
>      [12, 82, 34, 87, 100],
>      [103, 3, 105, 8, 96],
>      [113, 57, 9, 62, 74],
>      [56, 120, 55, 49, 35]],
>
>     square4 =
>     [[121, 108, 7, 20, 59],
>      [29, 28, 122, 125, 11],
>      [51, 15, 41, 124, 84],
>      [78, 54, 99, 24, 60],
>      [36, 110, 46, 22, 101]]
>     )
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
>
>   



More information about the Edu-sig mailing list