Main code with perceptron