Last active
December 24, 2015 11:09
-
-
Save BandanaKM/6789105 to your computer and use it in GitHub Desktop.
Just trying to demonstrate how I broke it down; am still going through to remove errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a method called create_groups that, given an array of student names, | |
# a group size, and a number of groups, will return an array of groups of | |
# of students with no student in adjacent groups | |
get_students | |
[ | |
"Alex Chiu", | |
"Amanda Himmelstoss", | |
"Anders Ramsay", | |
"Bana Malik", | |
"Brendan Manley", | |
"Charlotte Chang", | |
"Christopher Lee", | |
"Daniel Chang", | |
"David Bella", | |
"Edina Vath", | |
"Emily Xie", | |
"Greg Eng", | |
"Ian Miller", | |
"Iris Lee", | |
"Ivan Brennan", | |
"James Tong", | |
"Jeanne Roniger", | |
"Joe O'Conor", | |
"John Richardson", | |
"Joshua Scaglione", | |
"Kyle Shike", | |
"Logan Hasson", | |
"Manuel Neuhauser", | |
"Margaret Lee", | |
"Matt Campbell", | |
"Michael Polycarpou", | |
"Mike Spangler", | |
"Raymond Gan", | |
"Rosanne Hoyem", | |
"Sam Yang", | |
"Samuel Owens", | |
"Saron Yitbarek", | |
"Scott Luptowski", | |
"Vivian Zhang", | |
"Sonja Hall", | |
"Stephanie Oh", | |
"Theo Vora", | |
"Thomas Surgent", | |
"Tiffany Peon", | |
"Trevor McKendrick", | |
"Vinney Cavallo" | |
] | |
group_arr_one = [] | |
group_arr_two = [] | |
group_arr_three =[] | |
group_arr_four = [] | |
def create_groups(get_students, i) | |
new_groups_arr.new = [] | |
if get_students.count % 4 == 1 | |
get_students.each do | get_students, i| | |
group_arr_one << i | |
end | |
if get_students.count % 4 == 2 | |
get_students.each do |get_students, i| | |
group_arr_two << i | |
end | |
if get_students.count % 4 == 3 | |
get_students.each do |get_students, i| | |
group_arr_three << i | |
end | |
if get_students.count % 4 == 0 | |
get_students.each do |get_students, i| | |
group_arr_four << i | |
end | |
new_groups_arr << group_arr_one << group_arr_two << group_arr_three << group_arr_four | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment