Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cover_the_gap_students(shed, n, group):
- pr = [-1] * 6
- for lesson in range(7):
- for day in range(6):
- if shed[group][lesson][day] != 0:
- pr[day] = lesson
- cur = []
- for i in range(len(pr)):
- if pr != -1:
- cur.append(i)
- rand = choice(len(cur))
- rs = cur[rand]
- first = -1
- # here we are a little bit greedy
- for lesson in range(7):
- if shed[group][lesson][rand] != 0 and first == -1:
- first = lesson
- if shed[group][lesson][rand] != 0 and first != -1 and lesson < rs:
- pos.append(lesson)
- # if possible returns shed, else returns -1
- for i in range(len(pos)):
- shed[group][rs][rand], shed[group][pos[i]][rand] = shed[group][pos[i]][rand],shed[group][rs][rand]
- if checkcorrectness(shed,n,a):
- return shed
- shed[group][rs][rand], shed[group][pos[i]][rand] = shed[group][pos[i]][rand],shed[group][rs][rand]
- return -1
- def cover_the_gap_teachers():
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement