public void toFile(String filename) throws FileNotFoundException, UnsupportedEncodingException {
		PrintWriter writer = new PrintWriter(filename, "UTF-8");
		writer.println(h + " " + w);
		for (int y = 0; y < h; ++y)
		{
			for (int x = 0; x < w; ++x)
				writer.print(cells[x][y] ? "#" : ".");
			writer.println();
		}
		writer.close();
	}