Difference between revisions of "Assessment 2008 Easy"

From Progzoo
Jump to: navigation, search
(Solitaire)
(Connect 4)
Line 147: Line 147:
 
}
 
}
 
</prog>
 
</prog>
<answer>
+
<answer><![CDATA[
static void drawFlag(Graphics2D g){  
+
static int sw = 148;static int sh = 128;
   BufferedImage img= new BufferedImage(148,128,
+
static void drawFlag(Graphics2D g){
      BufferedImage.TYPE_INT_ARGB);
+
   int r=8;
   try{
+
  int d=20;
     img  = (BufferedImage)ImageIO.read(new File("connect4.png"));
+
  g.translate((sw-7*d)/2,(sh-6*d)/2);
    g.drawImage(img,0,0,null);
+
  g.setColor(new Color(160,146,100));
   }catch(Exception e){}
+
  g.fillRect(0,0,7*d,6*d);
 +
  g.setColor(Color.black);
 +
  g.drawRect(0,0,7*d,6*d);
 +
   for (int i=0;i<7;i++){
 +
     g.drawLine(i*d,0,i*d,6*d);
 +
    for (int j=0;j<6;j++){
 +
      g.setColor(Color.white);
 +
      g.fillOval(i*d-r+d/2,j*d-r+d/2,2*r,2*r);
 +
      g.setColor(Color.black);
 +
      g.drawOval(i*d-r+d/2,j*d-r+d/2,2*r,2*r);
 +
    }
 +
   }
 
}
 
}
</answer>
+
]]></answer>
 
</question>
 
</question>

Revision as of 00:58, 10 November 2008

Noughts and Crosses

Noughts and Crosses
  • The lines use rounded end-caps (see Drawing_Lines)
  • The lines have thickness 10
  • Each line is 150
  • The background is 200x200


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

Chess

Simple Chess Board
  • The background is 160x160


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

Go

Go
  • The board color is 220,179,92
  • There are 19 lines across and 19 down
  • The separation is 8
  • The background is 160x160


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

Solitaire

Solitaire
  • Each circle has radius 6
  • The circles are 16 apart
  • The background is 150x150
  • The big disk has radius 72
  • The green in 39,155,102


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

Connect 4

Connect 4
  • Each circle has radius 8
  • The circles are 20 apart
  • The background is 148x128
  • The color is 160,146,100


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