implemented end of turn and pathfinding