Neuron 101

Solving by search / Search problem

Türkçe

Plate13

Unit 2 · Topic 2 of 10

Search problem

Easy, 6 min, 7 steps

S
Keyboard: left and right arrows change the step, space plays and pauses.

Step 1 of 7 State

State

In the maze a state is the cell the agent is in: a row and a column. The initial state is S. The map has 60 open cells, so there are 60 states.

Tap a part of the scene to see its details here.

Open in Colab
  1. class Labirent:
  2. def __init__(self, harita):
  3. self.h = harita
  4. self.baslangic = (0, 0)
  5. def eylemler(self, d):
  6. r, c = d
  7. adaylar = [(r-1, c), (r, c+1),
  8. (r+1, c), (r, c-1)]
  9. return [a for a in adaylar
  10. if self.acik(a)]
  11. def sonuc(self, d, eylem):
  12. return eylem
  13. def hedef_mi(self, d):
  14. return d == (6, 11)
  15. def maliyet(self, eylem):
  16. if self.camur(eylem):
  17. return 3
  18. return 1
durumSayisi
60
eylemSayisi
2
yolUzunlugu
0
maliyet
0