# Q-Learning Algorithmus does not work

Hey I am training an initialized Neural Network with this Method

public void rlearn(ArrayList<Tuple> tupels, double learningrate, double discountfactor) {

MLDataSet set = new BasicMLDataSet();
MLDataSet input = new BasicMLDataSet();
MLDataSet ideal = new BasicMLDataSet();
for(int i = 0; i > tupels.size()-1; i++) {
MLData datain = new BasicMLData(45);
MLData dataout = new BasicMLData(4);
int index = 0;
for(double w : tupels.get(i).statefirst.elements) {
index = 0;
for(int k = 0; k < tupels.get(i).qactions.elements.length;k++) {

if(k == tupels.get(i).actionTaken) {
//New Q - Value
double currentQValue = tupels.get(i).qactions.getElement(k);
double reward = tupels.get(i).rewardafter;
//Calculate maximal Q Value of next State
double max = Double.MIN_VALUE;
for(double w : tupels.get(i+1).qactions.elements) {
if(w > max) {
max = w;
}
}
dataout.add(index++,currentQValue + learningrate*(reward + discountfactor*max - currentQValue));
} else {
}
}

}
System.out.println("Training Data: " + set.size());
if(set.size() != 0) {
Backpropagation prop = new Backpropagation(nn, set);
prop.setLearningRate(0.1);
prop.iteration(10);

System.out.println("Training Done: " + prop.getError());
}
}


Unfortunately this does not work pretty well. The Error is converging to Zero (pretty fast from 10000), but the Neural Net does not seem to have learned something (it is big enough)

The actual goal is to create a NN which can play something similar like astroids. Therefore the goal is to survive as long as possible. After every frame the NN gets +1 Point, if it dies -100;

Edit: The game looks like https://youtu.be/qxGR2bgj8VY (I coded it) but the AI can only go up,down,left and right. Furthermore, the AI can only steer the Player every 1/3 second...