algorithm in room model working well