Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main (String[] args){
- Grid e = new Grid(15,15);
- e.setVisible(true);
- int j = 1;
- for (int i=0; i<15; i=i+2){
- for(int g = 0; g<15; g++){
- e.setSquareText(g, i, j);
- }
- j++;
- }
- ---------------------
- import unit4.gridLib.*;
- import java.util.Random;
- public class NewClass {
- public static void main (String[] args){
- Grid e = new Grid(5,20);
- e.setVisible(true);
- Random r = new Random();
- for (int i=0; i<20; i++){
- int sum = 0;
- for(int g = 0; g<5; g++){
- int j = r.nextInt(100);
- if(g==4)
- e.setSquareText(g, i, sum);
- else
- e.setSquareText(g, i, j);
- sum+=j;
- }
- }
- }
- }
- --------------------------------
- public static void main (String[] args){
- Grid e = new Grid(5,20);
- e.setVisible(true);
- Random r = new Random();
- int min = 500;
- int k = 0;
- for (int i=0; i<20; i++){
- int sum = 0;
- for(int g = 0; g<5; g++){
- int j = r.nextInt(100);
- sum+=j;
- e.setSquareText(g, i, j);
- if (g==4){
- if(i==0){
- min=sum;
- }
- if (sum<min){
- min=sum;
- k=i;
- }
- }
- }
- }
- System.out.println(k);
- }
- }
- public static void main(String[] args) {
- Grid e = new Grid(10,20);
- e.setVisible(true);
- for (int i = 0; i<20; i++){
- e.setSquareColor(0, i, Color.red);
- Grid.delay(100);
- if(i!=19)
- e.clear();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement