_Mathematica World_ is an electronic magazine aimed at helping people
use Mathematica effectively, and to this end we run two programming
competitions.
The quarterly "International" competition has Open and Student
divisions, and is intended to be more challenging than the monthly
"Friendly" competition.
Entries are welcomed from anyone, and there are $100 and $50 prizes
respectively for the best solutions. Results will be posted to the
MathGroup mailing list and sci.math.symbolic.
A defensive word: although _Mathematica World_ is available by
subscription only, these competitions are open to all and it is our
opinion that this article is of interest and relevant to readers of
these groups.
The current problems are given below: please see a follow-up article
for the results of the last International and Friendly competitions.
Tim Adam
Executive Editor,
Mathematica World
Mathematica World Friendly Programming Competition
This is open to anyone, and the problem is to be seen as an exercise
through which we can all learn from each other. We especially
encourage inexperienced programmers to attempt the problem in order to
improve their programming skills. If this applies to you, please
indicate in your entry if you would like some feedback privately on
your solution.
This month's problem:
Consider the cube plotted by the command below to be described by the
three-dimensional array {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}}. Generate
the list of similar descriptions of the cube in all possible
orientations. You might want to try to generalize this to n
dimensions.
Show[Graphics[{
GrayLevel[0.0],
Thickness[0.005],
Line[{{51.37404, 135.67987}, {109.10594, 175.36909}}],
Line[{{51.37404, 135.67987}, {152.40236, 104.10685}}],
Line[{{64.00258, 55.39629}, {51.37404, 135.67987}}],
Line[{{109.10594, 175.36909}, {110.90954, 103.20505}}],
Line[{{110.90954, 103.20505}, {64.00258, 55.39629}}],
Line[{{110.90954, 103.20505}, {183.97538, 79.75157}}],
Line[{{147.89336, 20.21774}, {64.00258, 55.39629}}],
Line[{{147.89336, 20.21774}, {183.97538, 79.75157}}],
Line[{{152.40236, 104.10685}, {147.89336, 20.21774}}],
Line[{{183.97538, 79.75157}, {194.79865, 156.42628}}],
Line[{{194.79865, 156.42628}, {109.10594, 175.36909}}],
Line[{{194.79865, 156.42628}, {152.40236, 104.10685}}],
Text[FontForm["1", {"Helvetica", 12}],
{41.90347, 135.22897}, {-1.0, -1.0}],
Text[FontForm["2", {"Helvetica", 12}],
{147.44246, 110.87369}, {-1.0, -1.0}],
Text[FontForm["3", {"Helvetica", 12}],
{106.84977, 175.82166}, {-1.0, -1.0}],
Text[FontForm["4", {"Helvetica", 12}],
{196.15302, 159.58258}, {-1.0, -1.0}],
Text[FontForm["5", {"Helvetica", 12}],
{50.02134, 45.92739}, {-1.0, -1.0}],
Text[FontForm["6", {"Helvetica", 12}],
{139.32459, 5.33303}, {-1.0, -1.0}],
Text[FontForm["7", {"Helvetica", 12}],
{111.85977, 81.50841}, {-1.0, -1.0}],
Text[FontForm["8", {"Helvetica", 12}],
{188.03515, 70.28100}, {-1.0, -1.0}]
}], AspectRatio->1.10714,
PlotRange->{{41.0, 209.0}, {4.0, 190.0}}];
For example, another such description would be {{{6, 8}, {2, 4}},
{{5, 7}, {1, 3}}} because the cube can be rotated to this position:
Show[Graphics[{
GrayLevel[0.0],
Thickness[0.005],
Line[{{51.37404, 135.67987}, {109.10594, 175.36909}}],
Line[{{51.37404, 135.67987}, {152.40236, 104.10685}}],
Line[{{64.00258, 55.39629}, {51.37404, 135.67987}}],
Line[{{109.10594, 175.36909}, {110.90954, 103.20505}}],
Line[{{110.90954, 103.20505}, {64.00258, 55.39629}}],
Line[{{110.90954, 103.20505}, {183.97538, 79.75157}}],
Line[{{147.89336, 20.21774}, {64.00258, 55.39629}}],
Line[{{147.89336, 20.21774}, {183.97538, 79.75157}}],
Line[{{152.40236, 104.10685}, {147.89336, 20.21774}}],
Line[{{183.97538, 79.75157}, {194.79865, 156.42628}}],
Line[{{194.79865, 156.42628}, {109.10594, 175.36909}}],
Line[{{194.79865, 156.42628}, {152.40236, 104.10685}}],
Text[FontForm["6", {"Helvetica", 12}],
{41.90347, 135.22897}, {-1.0, -1.0}],
Text[FontForm["8", {"Helvetica", 12}],
{147.44246, 110.87369}, {-1.0, -1.0}],
Text[FontForm["2", {"Helvetica", 12}],
{106.84977, 175.82166}, {-1.0, -1.0}],
Text[FontForm["4", {"Helvetica", 12}],
{196.15302, 159.58258}, {-1.0, -1.0}],
Text[FontForm["5", {"Helvetica", 12}],
{50.02134, 45.92739}, {-1.0, -1.0}],
Text[FontForm["7", {"Helvetica", 12}],
{139.32459, 5.33303}, {-1.0, -1.0}],
Text[FontForm["1", {"Helvetica", 12}],
{111.85977, 81.50841}, {-1.0, -1.0}],
Text[FontForm["3", {"Helvetica", 12}],
{188.03515, 70.28100}, {-1.0, -1.0}]
}], AspectRatio->1.10714,
PlotRange->{{41.0, 209.0}, {4.0, 190.0}}];
Solutions will be ranked - and the best and interesting solutions will be
published and discussed in the July issue.
A prize of US$50 and a commemerative plaque will be awarded to the
highest ranked solution.
Please send solutions to the Friendly Programming Competition by
June 20 1994, notebook or text to:
adams at maths.mu.oz.au
Subject: MW Friendly Competition
Or, on 3.5" diskette (Mac or MS-DOS formatted) to:
Programming Competition
Mathematica World
Ormond College
Parkville, Victoria, 3052
Australia
Mathematica World International Programming Competition
Welcome to our second quarterly competition. There will be prizes for
the best solutions (details below). Please send any problems that you
think would be suitable for any of these.
The second quarter competition closes at the end of June 1994, results
will be in the August issue. The best and interesting solutions will
be published and discussed.
*****************************************************
Anyone can submit a solution to any of the problems below.
Solutions will be ranked - and the top few in each section acknowledged.
A prize of US$100 and a commemerative plaque will be awarded to the
highest ranked solution in each section.
To be eligible for the prize in a section you must satisfy the educational
criteria.
*****************************************************
International Programming Competition - Student
For current students who have not completed a university degree.
(also includes High School students)
Consider a game in which there are a fixed number n of chairs arranged
in a circle, and people possessing various positive numbers of chips
occupying some or all of these chairs.
At each round of the game, everyone moves the same number of chairs to
the right (clockwise) as they have chips. If after this move two or
more people occupy the same chair, the person there with the least
chips gets the chips of the rest of the people at that chair, who are
now out of the game. Ties are broken randomly.
The game can be represented by a list of n numbers, the numbers of
chips held by the person at each chair. The problem is to write a
function to take one of these lists and return the corresponding list
after one more round of the game.
For example, if the initial configuration is {1, 4, 2, 3}, the next one
would be {2,5,3,0}, then {0,3,7,0}, etc.
International Programming Competition - Open
Open to everyone.
Consider a game in which there are a fixed number n of chairs arranged
in a circle, and people possessing various positive numbers of chips
occupying some or all of these chairs.
At each round of the game, everyone moves the same number of chairs to
the right (clockwise) as they have chips. If after this move two or
more people occupy the same chair (a "collision"), one of them is
chosen at random to take all the chips of the rest of the people at
that chair, who are now out of the game.
The game can be represented by a list of n numbers, the numbers of
chips held by the person at each chair. The problem is to investigate
the game from an initial configuration which is a permutation of
Range[n]. The type of thing you could look at might be to identify
when there will be no further collisions because there is no point
continuing past there, e.g. if there is only one person left. The
problem is fairly loosely specified to allow you to decide what
direction you take and to use a fuller range of programming and
problem-solving skills.
As an example of a game, if the initial configuration is {1, 4, 2, 3},
the next one would be {2,5,3,0}, then {0,3,7,0}, {3,7,0,0}, {7,0,0,3},
etc.
Judging Criteria
Solutions will be judged according to the following criteria:
correctness
clarity
efficiency
elegance
generality
creativity
Submitting Solutions
Please send solutions to the International Programming Competition by
30 June 1994, notebook or text to:
adams at maths.mu.oz.au
Subject: MW Competition
Or, on 3.5" diskette (Mac or MS-DOS formatted) to:
Programming Competition
Mathematica World
Ormond College
Parkville, Victoria 3052
Australia