Yes you can use LSTM or RNN,but from my point of view can be other possibilities. If you want to use the recurrent neural network you should use a supervised training mode:
(many - to - many)
The input x1 is the move made by the rat at time1 and y1 is the move of the rat at time 2, x2 is the move of the rat at time 2 and y2 is the move of the rat at time3 and so on...
But for your kind of problem a recurrent netowork could not be the best choice. What i recommend you is to use a decision tree, or a random forest algorithm, since the possible outcomes of the rat are just 4: right, left, up, down, and you have a finite state of positions, "the maze". The best you can do is build a random forest algorithm where the features can be, for instance, the walls around the rat, the distances of these walls from it,the distance from the exit and the number of times the rat has passed through that state, and the labels are: right, left, up, down.
Remember that a machine learning model works better then a deep learning model if the data are not consistent and a random forest is a very powerful machine learning tool