-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesk_functions.py
More file actions
22 lines (18 loc) · 833 Bytes
/
desk_functions.py
File metadata and controls
22 lines (18 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import students
from typing import Dict, Tuple
def standard_pairs_layout(columns, rows):
num_possible_columns = 3 * columns // 2 - 1
num_possible_rows = 2 * rows - 1
pairs = [(x, y)
for y in range(num_possible_rows)
for x in range(num_possible_columns)
if x % 3 < 2 if y % 2 == 0]
return pairs
def load_basic_seating_plan_from_file(filename: str) -> Dict[str, Tuple]:
student_list = list(students.parse_course_list(filename).values())
pairs = standard_pairs_layout(6, 4)
number_empties = len(pairs) - len(student_list)
if number_empties < 0:
raise NotImplementedError("Cannot handle more than 24 students, legal limit in gva!!")
padded_student_list = ["empty"]*number_empties + student_list[::-1]
return dict(zip(pairs, padded_student_list))