123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import bisect
- from Sonar import *
-
- p = 3
-
- start = 2
- end = 2
- array = [-1] * (p*p)
- array[1] = 0
- n = (p*p)
-
- c = Sonar()
- counter = 0
-
- while 1:
- costas = 0
-
- if end < start:
- break
- if array[end] + 1> n-1: #or len(next) == 0 or bisect.bisect(next, array[end]) >= len(next):
- #bisect.insort(next, array[end])
- array[end] = -1
- end -=1
- continue
-
- #if not array[end] == 0:
- #tmp = array[end]
- # array[end] += 1 #next[bisect.bisect_right(next, tmp)]
- #next.remove(array[end])
- #bisect.insort(next, tmp)
- #else:
-
- array[end] += 1
- counter+= 1
- #print "Check Point:", array[:end+1]
- if c.is3DSonar1D(array[:end+1], p, end+1):
- costas = 1
- if end+1 == n:
- print array[:end+1]
-
-
- if costas and end < (n-1):
- end += 1
- elif costas and end == (n-1):
- pass
- else:
- pass
|