excel - Python Random Seat Generator with Memory -


so i've done searching around similar projects , haven't come across has pushed me in right direction yet how tackle project i'm coming here stack advice. not looking full solution project, tackle myself, looking advice on how approach it.

what i'm trying do

i trying write program randomly generate seating charts 8 weeks of class. reads list of 80 names excel file , spits out excel file, within output file 8 worksheets, 1 each week, each different randomly generated 8x10 seating chart. easy right?

there 3 additional criteria achieve make bit more perplexing:

  • i avoid having 1 student sit next (in front of, behind, or side of) same student 2 weeks
  • i not have 1 student sit in front or rows more 1 week well
  • these students live in dormitories together, , not have students same room sitting next 1 during week

this 8 week mba class , whole reason why trying introduce students new peers , spark new conversations.

what i've done far

from openpyxl import workbook, load_workbook import random import itertools   load_wb = raw_input('what name of file containing students?\n') num_of_weeks = int(raw_input('how many weeks like?\n'))   dest_filename = 'seating_chart.xlsx' students = []   load_wb = load_workbook(load_wb).active  cell in load_wb.iter_rows():   students.append(cell[0].value)   def make_grid():   #make 8 x 10 grid   y_list = list(range(1, 11))   x_list = list(range(1, 9))   grid = []    y in y_list:     x in x_list:       grid.append((x,y))    return grid    save_wb = workbook() grid = make_grid() week in range(num_of_weeks):   week +=1    if week == 1:     ws = save_wb.active   else:     ws = save_wb.create_sheet()   ws.title = 'week '+str(week)    #randomly shuffle students array   random.shuffle(students)   x, student in itertools.izip(grid, students):     x,y = x     ws.cell(row=x, column=y, value=student)   save_wb.save(filename=dest_filename) 

i know going have store values of each student sitting each week , reference these when generating random charts relatively new python , not sure how best approach this.

i appreciate everyone's advice in advance! :)

joey

here's 1 method:

  1. divide class 2 groups, such no 1 in group lives in same room group b (possible if dorm groups 8 people, otherwise still possible)
  2. arrange group in checkerboard pattern, , have them keep seats throughout
  3. arrange group b checkboard pattern, sitting around a. each lesson, move group b 3 seats in short dimension , 1 seat in long dimension. wrap around both ways torus. 8 goes here before repeat seat, convenient

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -