//
// This is only a SKELETON file for the 'Kindergarten Garden' exercise.
// It's been provided as a convenience to get you started writing code faster.
//
const DEFAULT_STUDENTS = [
'Alice',
'Bob',
'Charlie',
'David',
'Eve',
'Fred',
'Ginny',
'Harriet',
'Ileana',
'Joseph',
'Kincaid',
'Larry',
];
const PLANT_CODES = {
G: 'grass',
V: 'violets',
R: 'radishes',
C: 'clover',
};
export class Garden {
constructor(diagram, students = DEFAULT_STUDENTS) {
this.diagram = diagram;
this.students = students.sort();
}
plants(student) {
let [firstLine, secondLine] = this.diagram.split("\n");
let index = this.students.indexOf(student);
return [PLANT_CODES[firstLine[index2]],
PLANT_CODES[firstLine[index2+1]],
PLANT_CODES[secondLine[index2]],
PLANT_CODES[secondLine[index2+1]]];
}
}