leniuch

statki

Feb 25th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. public class statki {
  2.     static String name;
  3.     static String surname;
  4.     static Boolean[][] board;
  5.    
  6.    
  7.     statki(String name, String surname, int lw, int lk){
  8.     this.name = name;
  9.     this.surname = surname;
  10.     this.board = new Boolean[lw][lk];
  11.         for(int x=0 ;x<lw;x++){
  12.             for (int y=0;y<lk;y++){
  13.                 board[x][y] = false;
  14.             }
  15.         }
  16.     }
  17.    
  18.     static void set_jednomasztowiec(int x, int y){
  19.     board[x][y]=true;
  20.     }
  21.    
  22.     static Boolean set_dwumasztowiec(int x, int y, int x2, int y2){
  23.    
  24.        if(x==x2||y==y2) {
  25.     board[x][y]=true;
  26.     board[x2][y2]=true;
  27.     return true;}
  28.        else return false;}
  29.    
  30.     static String shot(int x, int y){
  31.         if (board[x][y]==true)
  32.     return "trafiony";
  33.         else return "pudło";
  34.     }
Add Comment
Please, Sign In to add comment