Difference between revisions of "Assessment 2008 Hard"

From Progzoo
Jump to: navigation, search
(Ludo)
(Ludo)
Line 119: Line 119:
 
static int d = 16;
 
static int d = 16;
 
static void quarter(Graphics2D g,Color c){
 
static void quarter(Graphics2D g,Color c){
 +
  //This list of coordinates is describe square with a
 +
  //square cut out of it. Start in the middle top, go
 +
  //around the outside of the outer square then round
 +
  //the inner square
 +
  int x[] = new int[] {1,0,0,2,2,1,0,1,2};
 +
  int y[] = new int[] {0,0,2,2,0,0,1,2,1};
 
   Polygon p = new Polygon();
 
   Polygon p = new Polygon();
   p.addPoint(3*d,0);
+
   for (int i=0;i<x.length;i++)
  p.addPoint(0,0);
+
    p.addPoint(3*d*x[i],3*d*y[i]);
  p.addPoint(0,6*d);
+
  p.addPoint(6*d,6*d);
+
  p.addPoint(6*d,0);
+
  p.addPoint(3*d,0);
+
  p.addPoint(6*d,3*d);
+
  p.addPoint(3*d,6*d);
+
  p.addPoint(0,3*d);
+
 
   g.setColor(c);
 
   g.setColor(c);
 
   g.fillPolygon(p);
 
   g.fillPolygon(p);
 
   g.fillRect(d,6*d,d,2*d);
 
   g.fillRect(d,6*d,d,2*d);
 
   g.fillRect(2*d,7*d,4*d,d);
 
   g.fillRect(2*d,7*d,4*d,d);
   Polygon t =new Polygon(new int[]{6*d,6*d,15*d/2},new int[]{6*d,9*d,15*d/2},3);
+
   Polygon t =new Polygon(new int[]{6*d,6*d,15*d/2},
 +
                        new int[]{6*d,9*d,15*d/2},3);
 
   g.fillPolygon(t);
 
   g.fillPolygon(t);
 
   g.setColor(Color.black);
 
   g.setColor(Color.black);
Line 143: Line 143:
 
     g.drawLine(0,6*d+d*i,6*d,6*d+d*i);
 
     g.drawLine(0,6*d+d*i,6*d,6*d+d*i);
 
}
 
}
 +
 
static void drawFlag(Graphics2D g){
 
static void drawFlag(Graphics2D g){
 
   g.translate(8,8);
 
   g.translate(8,8);
 
   g.setColor(new Color(228,228,228));
 
   g.setColor(new Color(228,228,228));
 
   g.fillRect(0,0,15*d,15*d);
 
   g.fillRect(0,0,15*d,15*d);
   quarter(g,Color.green);
+
   for (Color c:new Color[]{Color.green,Color.yellow,
  g.translate(0,15*d);
+
                          Color.blue, Color.red}){
  g.rotate(-Math.PI/2);
+
    quarter(g,c);
  quarter(g,Color.yellow);
+
    g.translate(0,15*d);
  g.translate(0,15*d);
+
    g.rotate(-Math.PI/2);
  g.rotate(-Math.PI/2);
+
  }
  quarter(g,Color.blue);
+
  g.translate(0,15*d);
+
  g.rotate(-Math.PI/2);
+
  quarter(g,Color.red);
+
  g.translate(0,15*d);
+
  g.rotate(-Math.PI/2);
+
 
}
 
}
 
]]></answer>
 
]]></answer>

Revision as of 01:26, 10 November 2008

Fanorona

Fanorona
  • The separation is 20
  • The disks have radius 6
  • The background is 184x104
  • The blue is 64,64,255


[Font] [Default] [Show] [Resize] [History] [Profile]

Snakes and Ladders

Snakes and Ladders
  • The squares are 24
  • The background is 241x241


[Font] [Default] [Show] [Resize] [History] [Profile]

Ludo

Ludo
  • The background is 256x256
  • The gray is 228, 228, 228


[Font] [Default] [Show] [Resize] [History] [Profile]

Cards

Deck of Cards


[Font] [Default] [Show] [Resize] [History] [Profile]

Monopoly

This is a large image and takes too much memory on the the progzoo system. Please use Dr Java or similar.

  • The width of each property is 85
  • The background is 1040x1040
  • You should use strings in the array


Monopoly.png

[Font] [Default] [Show] [Resize] [History] [Profile]