Added basic algorithm (without graphics.h