function choose() {
  var chosen = Math.floor(Math.random()*N);
  var minAngle = (chosen/N)*radians;
  var maxAngle = minAngle + arclen;
  animateChoice((minAngle+maxAngle)/2);
  g.setColor(colours[chosen%colours.length]);
  for (var i = segmentMax-segmentStep; i >= 0; i -= segmentStep)
    arc(i, perimMax, minAngle, maxAngle);
  arc(0, perimMax, minAngle, maxAngle);
  for (var r = 1; r < segmentMax; r += circleStep)
    g.fillCircle(centreX,centreY,r);
  g.fillCircle(centreX,centreY,segmentMax);
}
// choose a winning segment and animate its selection
choose a winning segment and animate its selection
choose a winning segment and animate its selection
function choose() {
  var chosen = Math.floor(Math.random()*N);
  var minAngle = (chosen/N)*radians;
  var maxAngle = minAngle + arclen;
  animateChoice((minAngle+maxAngle)/2);
  g.setColor(colours[chosen%colours.length]);
  for (var i = segmentMax-segmentStep; i >= 0; i -= segmentStep)
    arc(i, perimMax, minAngle, maxAngle);
  arc(0, perimMax, minAngle, maxAngle);
  for (var r = 1; r < segmentMax; r += circleStep)
    g.fillCircle(centreX,centreY,r);
  g.fillCircle(centreX,centreY,segmentMax);
}
function choose ( ) { var chosen = Math . floor ( Math . random ( ) * N ) ; var minAngle = ( chosen / N ) * radians ; var maxAngle = minAngle + arclen ; animateChoice ( ( minAngle + maxAngle ) / 2 ) ; g . setColor ( colours [ chosen % colours . length ] ) ; for ( var i = segmentMax - segmentStep ; i >= 0 ; i -= segmentStep ) arc ( i , perimMax , minAngle , maxAngle ) ; arc ( 0 , perimMax , minAngle , maxAngle ) ; for ( var r = 1 ; r < segmentMax ; r += circleStep ) g . fillCircle ( centreX , centreY , r ) ; g . fillCircle ( centreX , centreY , segmentMax ) ; }
choose a winning segment and animate its selection
choose a winning segment and animate its selection