Door Algorithm (Done)

Fix the bug