Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import org.kussmaul.simplegraphics.*;
- import org.kussmaul.simplegraphics.item.SimpleItem;
- public class Question1
- {
- static int test[][] = {{0,0}, {1,0}, {2,0}, {0,1}, {0,2}, {0,3}};
- Scanner scan = new Scanner(System.in);
- static SimpleGraphics sg = new SimpleGraphics();
- static SimpleItem square;
- static SimpleItem circle;
- public static void main(String[] args)
- {
- drawBoard();
- drawCheckers(test);
- }
- public static void drawBoard()
- {
- for (int i = 0; i < 800; i += 100)
- {
- for (int j = 0; j < 800; j += 100)
- {
- square = sg.drawRect(i, j, 100);
- }
- }
- }
- public static void drawCheckers(int[][] positions)
- {
- for (int[] yx : positions)
- {
- if (yx[0] % 2 != yx[1] % 2)
- {
- circle = sg.drawOval((yx[0] * 100) + 20, (yx[1] * 100) + 20, 60);
- }
- else
- {
- circle = sg.fillOval((yx[0] * 100) + 20, (yx[1] * 100) + 20, 60);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement