@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getActionCommand().equals("start")) {
			try {
				puzzle = new Puzzle(board, true, self);
				puzzle.execute();
			} catch (MyException e1) {
				status.append("MyException");
				e1.printStackTrace();
			}
		} else if (e.getActionCommand().equals("stop")) {
			puzzle.cancel(true);
			board = Experiment.randomPuzzle(0);
			updateGrid();
		} else if (e.getActionCommand().equals("randomize")) {
			puzzle.cancel(true);
			board = Experiment.randomPuzzle(Integer.parseInt(depthField.getText()));
			updateGrid();
		} else if (e.getActionCommand().equals("BFS")) {
			BFSButton.setSelected(true);
			RBFSButton.setSelected(false);
		} else if (e.getActionCommand().equals("RBFS")) {
			RBFSButton.setSelected(true);
			BFSButton.setSelected(false);
		} else if (e.getActionCommand().equals("start experiment")) {
			Experiment exp = new Experiment();
			if (RBFSButton.isSelected()) exp.setType(1);
									else exp.setType(0);
			exp.setNumTests(Integer.parseInt(numExpField.getText()));
			exp.setMaxDepth(Integer.parseInt(depthField.getText()));
			exp.execute();
		} else {
			status.append("Wrong command\n");
		}
	}