Advertisement
Guest User

Untitled

a guest
Feb 1st, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. NSDictionary *course_dict = @{
  2. @"CS 1" : @[],
  3. @"CS 31" : @[],
  4. @"CS 32" : @[@"CS 31"],
  5. @"CS 33" : @[@"CS 32"],
  6. @"CS 35L" : @[@"CS 31"],
  7. @"CS M51A" : @[],
  8. @"CS 111" : @[@"CS 32", @"CS 33", @"CS 35L"],
  9. @"CS M117" : @[],
  10. @"CS M151B" : @[@"CS 33", @"CS M51A"],
  11. @"CS 130" : @[@"CS 111"],
  12. @"CS 131" : @[@"CS 33", @"CS 35L"],
  13. @"CS 118" : @[@"CS 111"],
  14. @"CS 152A" : @[@"CS M51A"],
  15. @"CS 152B" : @[@"CS 151B"],
  16. @"CS 180" : @[@"CS 31", @"Math 61"],
  17. @"CS 181" : @[@"180"],
  18. @"Math 31A" : @[],
  19. @"Math 31B" : @[@"Math 31A"],
  20. @"Math 32A" : @[@"Math 31A"],
  21. @"Math 32B" : @[@"Math 31B", @"Math 32A"],
  22. @"Math 33A" : @[@"Math 32A"],
  23. @"Math 33B" : @[@"Math 31B"],
  24. @"Math 61" : @[@"Math 31A", @"Math 31B"],
  25. @"Phy 1A" : @[@"Math 31A", @"Math 31B"],
  26. @"Phy 1B" : @[@"Phy 1A", @"Math 32A", @"Math 31B"],
  27. @"Phy 1C" : @[@"Phy 1A", @"Phy 1B", @"Math 32A", @"Math 32B"],
  28. @"Phy 4AL" : @[@"Phy 1A"],
  29. @"Phy 4BL" : @[@"Phy 1A", @"Phy 1B"],
  30. };
  31.  
  32. // create registrar
  33. NSMutableArray *courses;
  34.  
  35. // for each course
  36. for (id key in course_dict) {
  37. Course *course = [[Course alloc] init];
  38. course.name = key;
  39. // for each prereq
  40. for (id prereq in [course_dict objectForKey:key]) {
  41. // add it to the list of prereqs
  42. Course *p = [[Course alloc] init];
  43. p.name = prereq;
  44. [course.prereqs addObject:p];
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement