Advertisement
Parasect

Untitled

Sep 1st, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. public static void main (String[] args){
  2. Grid e = new Grid(15,15);
  3. e.setVisible(true);
  4. int j = 1;
  5. for (int i=0; i<15; i=i+2){
  6. for(int g = 0; g<15; g++){
  7. e.setSquareText(g, i, j);
  8. }
  9. j++;
  10. }
  11. ---------------------
  12. import unit4.gridLib.*;
  13. import java.util.Random;
  14. public class NewClass {
  15. public static void main (String[] args){
  16. Grid e = new Grid(5,20);
  17. e.setVisible(true);
  18. Random r = new Random();
  19.  
  20. for (int i=0; i<20; i++){
  21. int sum = 0;
  22. for(int g = 0; g<5; g++){
  23. int j = r.nextInt(100);
  24. if(g==4)
  25. e.setSquareText(g, i, sum);
  26. else
  27. e.setSquareText(g, i, j);
  28. sum+=j;
  29. }
  30. }
  31. }
  32. }
  33. --------------------------------
  34. public static void main (String[] args){
  35. Grid e = new Grid(5,20);
  36. e.setVisible(true);
  37. Random r = new Random();
  38. int min = 500;
  39. int k = 0;
  40. for (int i=0; i<20; i++){
  41. int sum = 0;
  42. for(int g = 0; g<5; g++){
  43. int j = r.nextInt(100);
  44. sum+=j;
  45. e.setSquareText(g, i, j);
  46.  
  47. if (g==4){
  48. if(i==0){
  49. min=sum;
  50. }
  51. if (sum<min){
  52. min=sum;
  53. k=i;
  54. }
  55. }
  56. }
  57.  
  58. }
  59. System.out.println(k);
  60. }
  61. }
  62.  
  63.  
  64. public static void main(String[] args) {
  65. Grid e = new Grid(10,20);
  66. e.setVisible(true);
  67. for (int i = 0; i<20; i++){
  68. e.setSquareColor(0, i, Color.red);
  69. Grid.delay(100);
  70. if(i!=19)
  71. e.clear();
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement