private void endTurn() {//{{{
    	if(!(networkSetting.equals("Client") || networkSetting.equals("Server"))) {
	    	if(selectedPiece.isPlayer()) {
                grid.killSacrifices(false);
                grid.repaint();
				setState(State.ENEMY_SELECT);
			} else {
                grid.killSacrifices(true);
                grid.repaint();
				setState(State.PLAYER_SELECT);
			}
    	} else {
    		if(selectedPiece.isPlayer()) {
                grid.killSacrifices(true);
                grid.repaint();
				setState(State.PLAYER_SELECT);
			} else {
                grid.killSacrifices(true);
                grid.repaint();
				setState(State.ENEMY_SELECT);
			}
    	}
    	clock.restartTimer();
    	grid.repaint();
    	moveString = moveString.substring(0,moveString.length()-3);
    	//System.out.println("MoveString: " + moveString);
		try{
			out.writeObject(moveString);
			out.flush();
		} catch (Exception e) {}
		
		clearTempData();
        if(outOfMoves()) { 
            grid.loseMessage();
            this.run("GameOver", null);
            return;
        }
        movesRemaining--;
        
        endFlag=true;
        
        if(networkSetting.equals("Server") || networkSetting.equals("Client")){
	        try {
				SwingUtilities.invokeLater(new Runnable() {public void run() {handleRemoteInput(true);}});
			} catch (Exception e) {}
        }
        
    }//}}}