public void render()
	{

		try
		{
			buffer = createImage(720, 720);
			Graphics g = buffer.getGraphics();
			Graphics i = image.getGraphics();
			g.drawImage(board.getImage(), 0, 0, 720, 720, this);
			i.drawImage(board.getImage(), 0, 0, 720, 720, this);
			g.setColor(Color.BLACK);
			g.drawRect(x - 25, y - 25, 50, 50);

			for (Square[] a : squares)
			{
				for (Square s : a)
				{

					if (s.piece != null)	// makes sure the space is open, if so it draws the piece
					{
						s.piece.draw(g);
						s.piece.draw(i);
					}
				}

			}
			// If both black and white pass in the same turn the game ends
			if ((whitePass && blackPass) || numOfEmptySquares() == 0)
			{
				dispose();
			}
			// This was our test to see whether the groups and territories were working
			// for (Group h : groups)
			// {
			// h.numOfLiberties();
			// Color random = new Color((int) (Math.random() * 256), (int) (Math.random() * 256),
			// (int) (Math.random() * 256));
			// for (Piece p : h.pieces)
			// {
			// g.setColor(random);
			// g.fillOval(p.where.x + 28, p.where.y + 28, 24, 24);
			// }
			// for (Square s : h.liberties)
			// {
			// g.setColor(random);
			// g.fillOval(s.x + 28, s.y + 28, 24, 24);
			// }
			// }
			// processTerritories();
			// for (Territory t : territories)
			// {
			// if (t.team() == 0)
			// g.setColor(Color.green);
			//
			// if (t.team() == 1)
			// g.setColor(Color.black);
			// if (t.team() == 2)
			// g.setColor(Color.white);
			// for (Square s : t.squares)
			// {
			// g.fillRect(s.x + 28, s.y + 28, 24, 24);
			// }
			//
			// }
			//if (!current)
			//{
			//	evaluate(10);
			//	current = true;
		//	}
			getGraphics().drawImage(buffer, 0, 0, 720, 720, this);	// so there is no updating
																	// flashes
		}
		catch (Exception e)
		{

		}
	}