Skip to content
Snippets Groups Projects
Commit 83d6fdb6 authored by Martin Mareš's avatar Martin Mareš
Browse files

Bludiště: Modernizace

parent a44d5fb6
No related branches found
No related tags found
No related merge requests found
......@@ -39,9 +39,9 @@ class Bludiste:
self.bludiste[r][s] = 'o'
def soused(rr, ss):
if 0 <= rr < self.radku and \
0 <= ss < self.sloupcu and \
self.bludiste[rr][ss] == '.':
if (0 <= rr < self.radku and
0 <= ss < self.sloupcu and
self.bludiste[rr][ss] == '.'):
self.bludiste[rr][ss] = 'o'
fronta.append((rr, ss))
......
......@@ -33,7 +33,7 @@ class Bludiste:
if d is None:
vystup.append("---")
else:
vystup.append("{:3d}".format(d))
vystup.append(f"{d:3d}")
print(" ".join(vystup))
def najdi_start(self):
......@@ -52,9 +52,9 @@ class Bludiste:
self.vzdalenost[r][s] = 0
def soused(rr, ss, dd):
if 0 <= rr < self.radku and \
0 <= ss < self.sloupcu and \
self.bludiste[rr][ss] == '.':
if (0 <= rr < self.radku and
0 <= ss < self.sloupcu and
self.bludiste[rr][ss] == '.'):
self.bludiste[rr][ss] = 'o'
self.vzdalenost[rr][ss] = dd
fronta.append((rr, ss))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment