import java.io.*; import java.util.*; import java.text.*; /** * trida reprezentujici pole na hrani piskvorek * @author Honza */ class PiskvorciPole { public int size; public char pole[][]; public char prazdno='_'; private int x, y; public boolean kriz = true; PiskvorciPole(int s) { //konstruktor size = s; pole = new char[size][size]; for(x=0;x= size || y < 0 || y >= size || pole[x][y] != prazdno) { chyba = false; System.out.println("\t\t\tneplatne pole!"); kriz = !kriz; continue; //dalsi pokus } pole[x][y]=hrac; } } } /** * trida demonstrujici pouziti tridy PiskvorciPole * @author Honza */ public class piskvorky { public static void main (String argv[]) { System.out.println("\t\t===> PISKVORKY <==="); System.out.println("\tHru lze prerusit stisknutim ctrl+c, nebo pres netbeans."); PiskvorciPole pp = new PiskvorciPole(20); //vytvorime nove pole 20x20 pp.hrat(); //spustime hru } }