Esempio n. 1
0
class Hanoi():
    def __init__(self, n=3, start="A", workspace="B", destination="C"):
        self.startp = Pole(start, 0, 0)
        self.workspacep = Pole(workspace, 150, 0)
        self.destinationp = Pole(destination, 300, 0)
        self.startp.showpole()
        self.workspacep.showpole()
        self.destinationp.showpole()
        for i in range(n):
            self.startp.pushdisk(
                Disk("d" + str(i), 0, i * 150, 20, (n - i) * 30))

    def move_disk(self, start, destination):
        disk = start.popdisk()
        destination.pushdisk(disk)

    def move_tower(self, n, s, d, w):
        if n == 1:
            self.move_disk(s, d)
        else:
            self.move_tower(n - 1, s, w, d)
            self.move_disk(s, d)
            self.move_tower(n - 1, w, d, s)

    def solve(self):
        self.move_tower(3, self.startp, self.destinationp, self.workspacep)
Esempio n. 2
0
 def __init__(self, cart_mass, pole_mass, pole_half_length, start_position, start_velocity, start_angle, start_angular_velocity):
     self.track_limits = 3
     self.start_position = start_position
     self.start_velocity = start_velocity
     self.start_angle = start_angle
     self.start_angular_velocity = start_angular_velocity
     self.cart = Cart(cart_mass, start_position, start_velocity)
     self.pole = Pole(pole_half_length, pole_mass, start_angle, start_angular_velocity)
Esempio n. 3
0
def ThreePointU(p1, p2, p3):
    '''
	ThreePointU calculates the strike (strike) and dip (dip)
	of a plane given the east (E), north (N), and up (U)
	coordinates of three non-collinear points on the plane
	
	p1, p2 and p3 are 1 x 3 arrays defining the location
	of the points in an ENU coordinate system. For each one
	of these arrays the first entry is the E coordinate,
	the second entry the N coordinate, and the third entry
	the U coordinate. These coordinates have uncertainties
	
	NOTE: strike and dip are returned in radians and they
	follow the right-hand rule format. The returned
	uncertainties are also in radians

	ThreePointU uses functions CartToSphU and Pole
	It also uses the uncertainties package from
	Eric O. Lebigot
	'''
    # make vectors v (p1 - p3) and u (p2 - p3)
    v = p1 - p2
    u = p2 - p3

    # take the cross product of v and u
    vcu0 = v[1] * u[2] - v[2] * u[1]
    vcu1 = v[2] * u[0] - v[0] * u[2]
    vcu2 = v[0] * u[1] - v[1] * u[0]

    # magnitude of the vector
    r = umath.sqrt(vcu0 * vcu0 + vcu1 * vcu1 + vcu2 * vcu2)

    # unit vector
    uvcu0 = vcu0 / r
    uvcu1 = vcu1 / r
    uvcu2 = vcu2 / r

    # make the pole vector in NED coordinates
    pole0 = uvcu1
    pole1 = uvcu0
    pole2 = -uvcu2

    # Make sure pole point downwards
    if pole2 < 0:
        pole0 *= -1
        pole1 *= -1
        pole2 *= -1

    # find the trend and plunge of the pole
    trd, plg = CartToSphU(pole0, pole1, pole2)

    # find strike and dip of plane
    strike, dip = Pole(trd, plg, 0)

    return strike, dip
Esempio n. 4
0
    def start(self):

        pole = Pole(self.mapa, self.rozmiar)
        pole.rysuj()
        pole.pokaz()
        self.mapa = pole.pole
        print("")
Esempio n. 5
0
 def ustaw_pola(self):
     index = 1
     self.pola = []
     for i in range(3):
         lista = []
         for j in range(3):
             pole = Pole()
             self.layout.addWidget(pole, i, j)
             lista.append(pole)
             if index % 3 == 0:
                 self.pola.append(lista)
             index += 1
     self.glowny_widget.setLayout(self.layout)
     self
     self.setCentralWidget(self.glowny_widget)
Esempio n. 6
0
 def __init__(self, n=3, start="A", workspace="B", destination="C"):
     self.startp = Pole(start, 0, 0)
     self.workspacep = Pole(workspace, 150, 0)
     self.destinationp = Pole(destination, 300, 0)
     self.startp.showpole()
     self.workspacep.showpole()
     self.destinationp.showpole()
     for i in range(n):
         self.startp.pushdisk(
             Disk("d" + str(i), 0, i * 150, 20, (n - i) * 30))
Esempio n. 7
0
def GreatCircle(strike,dip,sttype):
	'''
	GreatCircle computes the great circle path of a plane
	in an equal angle or equal area stereonet of unit radius
	
	strike = strike of plane
	dip = dip of plane
	sttype = type of stereonet: 0 = equal angle, 1 = equal area
	path = x and y coordinates of points in great circle path
	
	NOTE: strike and dip should be entered in radians.
	
	GreatCircle uses functions StCoordLine, Pole and Rotate
	
	Python function translated from the Matlab function
	GreatCircle in Allmendinger et al. (2012)
	'''
	pi = np.pi
	# Compute the pole to the plane. This will be the axis of
	# rotation to make the great circle
	trda, plga = Pole(strike,dip,1)
	
	# Now pick the strike line at the intersection of the
	# great circle with the primitive of the stereonet
	trd = strike
	plg = 0.0
	
	# To make the great circle, rotate the line 180 degrees
	# in increments of 1 degree
	rot = np.arange(0,181,1)*pi/180
	path = np.zeros((rot.shape[0],2))
	
	for i in range(rot.shape[0]):
	# Avoid joining ends of path
		if rot[i] == pi:
			rot[i] = rot[i]*0.9999
		# Rotate line
		rtrd, rplg = Rotate(trda,plga,rot[i],trd,plg,'a')
		# Calculate stereonet coordinates of rotated line
		# and add to great circle path
		path[i,0], path[i,1] = StCoordLine(rtrd,rplg,sttype)
	
	return path
	
Esempio n. 8
0
def ThreePoint(p1,p2,p3):
	'''
	ThreePoint calculates the strike (strike) and dip (dip)
	of a plane given the east (E), north (N), and up (U)
	coordinates of three non-collinear points on the plane
	
	p1, p2 and p3 are 1 x 3 arrays defining the location
	of the points in an ENU coordinate system. For each one
	of these arrays the first, second and third entries are 
	the E, N and U coordinates, respectively

	NOTE: strike and dip are returned in radians and they
	follow the right-hand rule format

	ThreePoint uses functions CartToSph and Pole
	'''
	# make vectors v (p1 - p3) and u (p2 - p3)
	v = p1 - p2
	u = p2 - p3
	# take the cross product of v and u
	vcu = np.cross(v,u)
	
	# make this vector a unit vector
	mvcu = la.norm(vcu) # magnitude of the vector
	if mvcu == 0: # If points collinear
		raise ValueError('Error: points are collinear')
	
	uvcu = vcu/mvcu # unit vector
	
	# make the pole vector in NED coordinates
	p = [uvcu[1], uvcu[0], -uvcu[2]]

	# Make pole point downwards
	if p[2] < 0:
		p = [-elem for elem in p]
	
	# find the trend and plunge of the pole
	trd, plg = CartToSph(p[0],p[1],p[2])
	
	# find strike and dip of plane
	strike, dip = Pole(trd, plg, 0)
	
	return strike, dip
Esempio n. 9
0
    def podlewanie_nawożenie(self, słowo, nw):

        print("Czy chcesz", słowo, "wszystkie rośliny?")
        print("[1] - Tak")
        print("[2] - Nie")
        wybor = self.wpisz_liczbe()
        if wybor == 1:
            pole = Pole(self.mapa, self.rozmiar)
            return pole.podlej_rosline(None, None, 1, nw, self.woda,
                                       self.nawoz)
        if wybor == 2:
            print("Podaj współrzędne:")
            wybor1 = self.wspolrzedne() - 1
            wybor2 = self.wspolrzedne() - 1
            pole = Pole(self.mapa, self.rozmiar)
            return pole.podlej_rosline(wybor1, wybor2, 2, nw, self.woda,
                                       self.nawoz)
Esempio n. 10
0
def Stereonet(trdv, plgv, intrad, sttype):
    '''
	Stereonet plots an equal angle or equal area stereonet
	of unit radius in any view direction
	
	trdv = trend of view direction
	plgv = plunge of view direction
	intrad = interval in radians between great or small circles
	sttype = type of stereonet. 0 = equal angle, 1 = equal area
	
	NOTE: All angles should be entered in radians
	
	Stereonet uses functions Pole, GeogrToView,
	SmallCircle and GreatCircle
	
	Python function translated from the Matlab function
	Stereonet in Allmendinger et al. (2012)
	'''
    pi = np.pi
    # some constants
    east = pi / 2.0
    west = 3.0 * east

    # Plot stereonet reference circle
    r = 1.0  # radius pf stereonet
    TH = np.arange(0, 360, 1) * pi / 180
    X = r * np.cos(TH)
    Y = r * np.sin(TH)

    # Make a larger figure
    plt.rcParams['figure.figsize'] = [15, 7.5]
    plt.plot(X, Y, 'k')
    plt.axis([-1, 1, -1, 1])
    plt.axis('equal')
    plt.axis('off')

    # Number of small circles
    nCircles = int(pi / (intrad * 2.0))

    # small circles
    # start at the North
    trd = 0.0
    plg = 0.0

    # If view direction is not the default (trdv=0,plgv=90)
    # transform line to view direction
    if trdv != 0.0 and plgv != east:
        trd, plg = GeogrToView(trd, plg, trdv, plgv)

    # Plot small circles
    for i in range(1, nCircles + 1):
        coneAngle = i * intrad
        path1, path2, np1, np2 = SmallCircle(trd, plg, coneAngle, sttype)
        plt.plot(path1[np.arange(0, np1), 0],
                 path1[np.arange(0, np1), 1],
                 color='gray',
                 linewidth=0.5)
        if np2 > 0:
            plt.plot(path2[np.arange(0, np2), 0],
                     path2[np.arange(0, np2), 1],
                     color='gray',
                     linewidth=0.5)

    # Great circles
    for i in range(0, nCircles * 2 + 1):
        # Western half
        if i <= nCircles:
            # Pole of great circle
            trd = west
            plg = i * intrad
            # Eastern half
        else:
            # Pole of great circle
            trd = east
            plg = (i - nCircles) * intrad
        # If pole is vertical shift it a little bit
        if plg == east:
            plg = plg * 0.9999
        # If view direction is not the default
        # (trdv = 0,plgv = 90)
        # transform line to view direction
        if trdv != 0.0 and plgv != east:
            trd, plg = GeogrToView(trd, plg, trdv, plgv)
        # Compute plane from pole
        strike, dip = Pole(trd, plg, 0)
        # Plot great circle
        path = GreatCircle(strike, dip, sttype)
        plt.plot(path[:, 0], path[:, 1], color='gray', linewidth=0.5)
Esempio n. 11
0
def FitPlane(pts):
    '''
	Fitplane computes the best-fit plane for a group of
	points (position vectors) on the plane

	USE: strike, dip, stdev = FitPlane(pts)

	pts is a n x 3 matrix containing the East (column 1),
	North (column 2), and Up (column 3) coordinates
	of n points on the plane

	strike and dip are returned in radians
	
	stdev is the standard deviation of the distance of
	each point from the best-fit plane

	FitPlane uses functions Pole and CartToSph
	'''
    # Compute the centroid of the selected points
    avge = np.mean(pts[:, 0])
    avgn = np.mean(pts[:, 1])
    avgu = np.mean(pts[:, 2])

    # Compute the points vectors minus the centroid
    pts[:, 0] = pts[:, 0] - avge
    pts[:, 1] = pts[:, 1] - avgn
    pts[:, 2] = pts[:, 2] - avgu

    # Compute the covariance/orientation matrix
    a = np.zeros((3, 3))
    for i in range(0, pts.shape[0]):
        ce = pts[i, 0]
        cn = pts[i, 1]
        cu = pts[i, 2]
        # compute orientation matrix
        a[0, 0] = a[0, 0] + ce * ce
        a[0, 1] = a[0, 1] + ce * cn
        a[0, 2] = a[0, 2] + ce * cu
        a[1, 1] = a[1, 1] + cn * cn
        a[1, 2] = a[1, 2] + cn * cu
        a[2, 2] = a[2, 2] + cu * cu
    # The orientation matrix is symmetric so the off-diagonal
    # components can be equated
    a[1, 0] = a[0, 1]
    a[2, 0] = a[0, 2]
    a[2, 1] = a[1, 2]

    # calculate the eigenvalues and eigenvectors of the
    # orientation matrix: use function eigh
    D, V = np.linalg.eigh(a)

    # Calculate pole to best-fit plane = lowest eigenvalue
    # vector in N, E, D coordinates
    cn = V[1, 0]
    ce = V[0, 0]
    cd = -V[2, 0]

    # Find trend and plunge of pole to best fit plane
    trd, plg = CartToSph(cn, ce, cd)

    # Find Best fit plane
    strike, dip = Pole(trd, plg, 0)

    # Calculate standard deviation = square root of
    # minimum eigenvalue
    stdev = np.sqrt(D[0])

    return strike, dip, stdev
Esempio n. 12
0
    def __init__(self, parent, title, x, y, swiat):
        super(Glowne_okno, self).__init__(parent,
                                          title=title,
                                          size=(1500, 800))
        self.__swiat = swiat
        self.__rozmiar_x = x
        self.__rozmiar_y = y
        self.__panel_gry = wx.lib.scrolledpanel.ScrolledPanel(self, -1)
        self.__panel_gry.SetupScrolling()
        self.__panel_gry.SetScrollRate(1, 1)
        self.__plansza = wx.GridSizer(y, x, 0, 0)
        self.__powiadomienia = wx.GridSizer(y, 1, 0, 0)
        self.__przyciski = wx.GridSizer(1, 3, 0, 0)
        self.__komunikaty = []
        self.__czcionka = wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD)
        self.__pola = []

        self.__moc_specjalna = wx.Button(self.__panel_gry,
                                         label="Moc specjalna",
                                         size=(self.__rozmiar_x * 27, 80))
        self.__moc_specjalna.SetBackgroundColour(wx.Colour("#596275"))
        self.__moc_specjalna.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
        self.__moc_specjalna.Bind(wx.EVT_BUTTON, self.onclick_moc_specjlna)

        self.__zapis = wx.Button(self.__panel_gry,
                                 label="Zapisz",
                                 size=(self.__rozmiar_x * 27, 80))
        self.__zapis.SetBackgroundColour(wx.Colour("#596275"))
        self.__zapis.Bind(wx.EVT_BUTTON, self.onclick_zapis)
        self.__zapis.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))

        self.__wczytaj = wx.Button(self.__panel_gry,
                                   label="Wczytaj",
                                   size=(self.__rozmiar_x * 27, 80))
        self.__wczytaj.SetBackgroundColour(wx.Colour("#596275"))
        self.__wczytaj.Bind(wx.EVT_BUTTON, self.onclick_wczytaj)
        self.__wczytaj.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))

        self.__przyciski.Add(self.__moc_specjalna, 0, wx.EXPAND)
        self.__przyciski.Add(self.__zapis, 0, wx.EXPAND)
        self.__przyciski.Add(self.__wczytaj, 0, wx.EXPAND)

        self.__iterator = 0
        for i in range(0, x * y):
            self.__pola.append(
                Pole(self.__panel_gry, "", self.__swiat,
                     i - (i // self.__rozmiar_x) * self.__rozmiar_x,
                     i // self.__rozmiar_x))
        for i in range(0, y):
            self.__komunikaty.append(
                wx.Button(self.__panel_gry, label="", size=(300, 80)))
        for i in range(0, x * y):
            self.__plansza.Add(self.__pola[i], 0, wx.EXPAND)
        for i in range(0, y):
            self.__komunikaty[i].SetBackgroundColour(wx.Colour("#596275"))
            self.__komunikaty[i].SetFont(
                wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD))
            self.__powiadomienia.Add(self.__komunikaty[i], 0, wx.EXPAND)

        topSizer = wx.BoxSizer(wx.VERTICAL)
        bagSizer = wx.GridBagSizer(hgap=3, vgap=3)
        bagSizer.Add(self.__plansza,
                     pos=(0, 1),
                     flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        bagSizer.Add(self.__powiadomienia,
                     pos=(0, 2),
                     flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        bagSizer.Add(self.__przyciski,
                     pos=(1, 1),
                     flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        bagSizer.AddGrowableCol(2, 0)
        topSizer.Add(bagSizer, 0, wx.ALL | wx.EXPAND, 5)

        self.__panel_gry.SetSizer(topSizer)
        topSizer.Fit(self)

        self.Bind(wx.EVT_CHAR_HOOK, self.onKey)
        self.Centre()
Esempio n. 13
0
def Angles(trd1, plg1, trd2, plg2, ans0):
    '''
	Angles calculates the angles between two lines,
	between two planes, the line which is the intersection
	of two planes, or the plane containing two apparent dips

	Angles(trd1,plg1,trd2,plg2,ans0) operates on
	two lines or planes with trend/plunge or
	strike/dip equal to trd1/plg1 and trd2/plg2

	ans0 is a character that tells the function what
	to calculate:

		ans0 = 'a' -> plane from two apparent dips
		ans0 = 'l' -> the angle between two lines

		In the above two cases, the user sends the trend
		and plunge of two lines

		ans0 = 'i' -> the intersection of two planes
		ans0 = 'p' -> the angle between two planes
 
		In the above two cases the user sends the strike
		and dip of two planes in RHR format

	NOTE: Input/Output angles are in radians

	Angles uses functions SphToCart, CartToSph and Pole

	Python function translated from the Matlab function
	Angles in Allmendinger et al. (2012)
	'''
    # If planes have been entered
    if ans0 == 'i' or ans0 == 'p':
        k = 1
    # Else if lines have been entered
    elif ans0 == 'a' or ans0 == 'l':
        k = 0

    # Calculate the direction cosines of the lines
    # or poles to planes
    cn1, ce1, cd1 = SphToCart(trd1, plg1, k)
    cn2, ce2, cd2 = SphToCart(trd2, plg2, k)

    # If angle between 2 lines or between
    # the poles to 2 planes
    if ans0 == 'l' or ans0 == 'p':
        # Use dot product
        ans1 = math.acos(cn1 * cn2 + ce1 * ce2 + cd1 * cd2)
        ans2 = math.pi - ans1

    # If intersection of two planes or pole to
    # a plane containing two apparent dips
    if ans0 == 'a' or ans0 == 'i':
        # If the 2 planes or lines are parallel
        # return an error
        if trd1 == trd2 and plg1 == plg2:
            raise ValueError('Error: lines or planes are parallel')
        # Else use cross product
        else:
            cn = ce1 * cd2 - cd1 * ce2
            ce = cd1 * cn2 - cn1 * cd2
            cd = cn1 * ce2 - ce1 * cn2
            #Make sure the vector points downe
            if cd < 0.0:
                cn = -cn
                ce = -ce
                cd = -cd
            # Convert vector to unit vector
            r = math.sqrt(cn * cn + ce * ce + cd * cd)
            # Calculate line of intersection or pole to plane
            trd, plg = CartToSph(cn / r, ce / r, cd / r)
            # If intersection of two planes
            if ans0 == 'i':
                ans1 = trd
                ans2 = plg
            # Else if plane containing two dips,
            # calculate plane from its pole
            elif ans0 == 'a':
                ans1, ans2 = Pole(trd, plg, 0)

    return ans1, ans2
Esempio n. 14
0
def AnglesU(trd1,plg1,trd2,plg2,ans0):
	'''
	AnglesU calculates the angles between two lines,
	between two planes, the line which is the intersection
	of two planes, or the plane containing two apparent dips

	AnglesU operates on two lines or planes with
	trend/plunge or strike/dip equal to trd1/plg1 and
	trd2/plg2. These angles have uncertainties

	ans0 is a character that tells the function what
	to calculate:

		ans0 = 'a' -> plane from two apparent dips
		ans0 = 'l' -> the angle between two lines

		In the above two cases, the user sends the trend
		and plunge of two lines

		ans0 = 'i' -> the intersection of two planes
		ans0 = 'p' -> the angle between two planes
 
		In the above two cases the user sends the strike
		and dip of two planes in RHR format

	NOTE: Input/Output angles are in radians and they
	have uncertainties in radians

	Angles uses functions SphToCartU, CartToSphU and Pole
	It also uses the uncertainties package from
	Eric O. Lebigot

	Based on Python function Angles
	'''
	# If planes have been entered
	if ans0 == 'i' or ans0 == 'p':
		k = 1
	# Else if lines have been entered
	elif ans0 == 'a' or ans0 == 'l':
		k = 0
	
	# Calculate the direction cosines of the lines or poles to planes
	cn1, ce1, cd1 = SphToCartU(trd1,plg1,k)
	cn2, ce2, cd2 = SphToCartU(trd2,plg2,k)
	
	# If angle between 2 lines or between the poles to 2 planes
	if ans0 == 'l' or ans0 == 'p':
		# Use dot product = Sum of the products of the direction cosines
		ans1 = umath.acos(cn1*cn2 + ce1*ce2 + cd1*cd2)
		ans2 = math.pi - ans1
	
	# If intersection of two planes or pole to a plane containing two
	# apparent dips
	if ans0 == 'a' or ans0 == 'i':
		# If the 2 planes or apparent dips are parallel return an error
		# Uncertainties are not needed for this comparison
		if trd1.n == trd2.n and plg1.n == plg2.n:
			raise ValueError('Error: lines or planes are parallel')
		# Else use cross product
		else:
			cn = ce1*cd2 - cd1*ce2
			ce = cd1*cn2 - cn1*cd2
			cd = cn1*ce2 - ce1*cn2
			# Make sure the vector points down into the lower hemisphere
			if cd < 0.0:
				cn = -cn
				ce = -ce
				cd = -cd
			# Convert vector to unit vector by dividing it by its length
			r = umath.sqrt(cn*cn+ce*ce+cd*cd)
			# Calculate line of intersection or pole to plane
			trd, plg = CartToSphU(cn/r,ce/r,cd/r)
			# If intersection of two planes
			if ans0 == 'i':
				ans1 = trd
				ans2 = plg
			# Else if plane containing two dips, calculate plane from its pole
			elif ans0 == 'a':
				ans1, ans2 = Pole(trd,plg,0)
	
	return ans1, ans2
Esempio n. 15
0
    def dzialania(self, a):

        if a == 1:

            if self.nasiona <= 0:
                print("Nie masz nasion!")
            else:
                print("Co chcesz posadzić?")
                print("[1] - Ziemniak.")
                print("[2] - Sałata.")
                print("[3] - Pomidor.")
                print("[4] - Truskawka.")
                wybierz = self.wpisz_liczbe()
                print("Na jakich współrzędnych chcesz sadzić?")
                print("x =", end=' ')
                wybor1 = self.wspolrzedne() - 1
                print("y =", end=' ')
                wybor2 = self.wspolrzedne() - 1
                pole = Pole(self.mapa, self.rozmiar)
                pole.posadz_rosline(wybor1, wybor2, wybierz)
                self.nasiona -= 1

        elif a == 2:

            print("Twoje rzeczy:")
            print("Monety: ", self.monety)
            print("Nawóz: ", self.nawoz)
            print("Woda: ", self.woda)
            print("Nasiona: ", self.nasiona)

        elif a == 3:

            print("Które pole chcesz sprawdzić?")
            print("x =", end=' ')
            wybor1 = self.wspolrzedne() - 1
            print("y =", end=' ')
            wybor2 = self.wspolrzedne() - 1
            pole = Pole(self.mapa, self.rozmiar)
            jakosc, wartosc, nawodnienie, nawożenie = pole.sprawdz(
                wybor1, wybor2)
            print("Wartość rośliny:", wartosc)
            print("Jakość rośliny:", jakosc)
            if nawodnienie == True:
                print("Roślina jest podlana.")
            elif nawodnienie == False:
                print("Roślina jest sucha.")
            if nawożenie == True:
                print("Roślina była nawożona.")
            elif nawożenie == False:
                print("Roślina nie była nawożona.")

        elif a == 4:

            print("[1] - Podlewanie.")
            print("[2] - Nawożenie.")

            wybor_czynnosci = self.wpisz_liczbe()
            if wybor_czynnosci == 1:
                print("Podlewanie")
                self.woda -= self.podlewanie_nawożenie("podlać", 1)
            elif wybor_czynnosci == 2:
                print("Nawożenie")
                self.nawoz -= self.podlewanie_nawożenie("nawieźć", 2)
            else:
                "Wybrano niepoprawną opcję!"

        elif a == 5:

            print("Co chcesz kupić?")
            print("[1] - Nasiona. 10zł/szt.")
            print("[2] - Wodę 1zł/szt.")
            print("[3] - Nawóz. 5zł/szt.")
            wybor_kupna = self.wpisz_liczbe()
            if wybor_kupna == 1:
                self.nasiona += self.zakupy(10)
            if wybor_kupna == 2:
                self.woda += self.zakupy(1)
            if wybor_kupna == 3:
                self.nawoz += self.zakupy(5)

        elif a == 6:

            print("Podaj współrzędne rośliny do wykopania.")
            print("x =", end=' ')
            wybor1 = self.wspolrzedne() - 1
            print("y =", end=' ')
            wybor2 = self.wspolrzedne() - 1
            pole = Pole(self.mapa, self.rozmiar)
            self.monety += pole.wykop_rosline(wybor1, wybor2)
            pole.pokaz()

        elif a == 0:

            print("Koniec tury.")
            pole = Pole(self.mapa, self.rozmiar)
            pole.dojrzewanie()
            pole.pokaz()
            self.cykl += 1

            with open("ekwipunek.txt", mode='w') as save_file2:
                zapisz_ilosc = csv.writer(save_file2, delimiter=' ')
                zapisz_ilosc.writerow([self.rozmiar])
                zapisz_ilosc.writerow([self.cykl])
                zapisz_ilosc.writerow([self.nasiona])
                zapisz_ilosc.writerow([self.woda])
                zapisz_ilosc.writerow([self.nawoz])
                zapisz_ilosc.writerow([self.monety])

            with open("ogrod_save.txt", mode='w') as save_file:
                zapisz_mape = csv.writer(save_file,
                                         delimiter=',',
                                         quotechar='"',
                                         quoting=csv.QUOTE_MINIMAL)

                for x in range(self.rozmiar):
                    for y in range(self.rozmiar):
                        zapisz_mape.writerow([pole.pole[x, y]])

        else:

            print("Wpisz poprawny punkt!")