While rooms can be hardcoded to specific classes, the algorithm also considers a list of suitable rooms for a class and attempts to keep classes in the same room. It prioritises specialist rooms for appropriate subjects and double periods when necessary.