The lab puzzle is a quiz essentially. Theres notes around the lab that tell you the order and what number to put in. if you cant figure it out there is a debug option hidden in the top right of the lab. If you go one square to the right of the right side machines door and hit enter it will just tell you the code. You can get the sword by going into the attic and pushing the boulder over one of the big cracks in the floor. Itll fall and knock the sword off the wall.