07-13-2024, 10:53 PM
Hi AB,
An artificial neural net (ANN) will usually have a fixed structure for a specific task. There will be a fixed number of inputs and another fixed number of outputs (and hidden layers). Each input and each output will be a value normalised in some way between 0 and 1. There will be a lot of training data (input and output) for the ANN to train with.
So, first I would do a bit of playing with the ANN to get the hang of above, like training it to do some simple tasks. You have to be able to use the ANN a bit first, understanding its limitations - I think of it like polynommial curve fitting in more dimensions.
e.g.] Calculate H,S,L from R,G,B colours - do try this or something similar - easy to code and I expect will be quite informative about how to use ANN.
Then think hard about what your input and output variables will be for rabbit training. Output is clearer (direction I would assume). Input is less clear, I guess it must somehow be everything the rabbit knows about its current situation condensed into a few numbers, perhaps where it has been, how close to the wall, anything it knows about snake position....
Bear in mind that the output direction used for training should be optimal - you are training it to reproduce the output for a given input, nothing more.
Perhaps you are trying to find a set of moves that will last the longest, which I think is what your current rabbit model does. It may be that a genetic algorithm (GA) would be more appropriate? In this case, we try to find an optimal chromosome (list of values - could be moves). Would need some more research (could be programmed in SB) and lots of training, each game is one evaluation and you would probably need 1000s, but it would gradually get better and better (up to a point).
In either case, the AI doesn't have much to go on in the current game to distinguish between strategies and random moves. A GA will actually confirm this if future generations make no appreciable improvement (survival is random, not just for the fittest!).
An artificial neural net (ANN) will usually have a fixed structure for a specific task. There will be a fixed number of inputs and another fixed number of outputs (and hidden layers). Each input and each output will be a value normalised in some way between 0 and 1. There will be a lot of training data (input and output) for the ANN to train with.
So, first I would do a bit of playing with the ANN to get the hang of above, like training it to do some simple tasks. You have to be able to use the ANN a bit first, understanding its limitations - I think of it like polynommial curve fitting in more dimensions.
e.g.] Calculate H,S,L from R,G,B colours - do try this or something similar - easy to code and I expect will be quite informative about how to use ANN.
Then think hard about what your input and output variables will be for rabbit training. Output is clearer (direction I would assume). Input is less clear, I guess it must somehow be everything the rabbit knows about its current situation condensed into a few numbers, perhaps where it has been, how close to the wall, anything it knows about snake position....
Bear in mind that the output direction used for training should be optimal - you are training it to reproduce the output for a given input, nothing more.
Perhaps you are trying to find a set of moves that will last the longest, which I think is what your current rabbit model does. It may be that a genetic algorithm (GA) would be more appropriate? In this case, we try to find an optimal chromosome (list of values - could be moves). Would need some more research (could be programmed in SB) and lots of training, each game is one evaluation and you would probably need 1000s, but it would gradually get better and better (up to a point).
In either case, the AI doesn't have much to go on in the current game to distinguish between strategies and random moves. A GA will actually confirm this if future generations make no appreciable improvement (survival is random, not just for the fittest!).