I'm working on making my own neural network using the NEAT algorithm. I have programmed the algorithm from scratch because I can't seem to get any of the libraries online working, but I'm 90% sure the actual algorithm for genetic breeding is working.
My issue is the creating of a fitness function because none of the ones I have tried to use seemed to have worked. All I'm trying to make is a simple XOR gate with two inputs and one output. I have tried something as basic as testing all the possible inputs ($[0,0], [0,1],$ etc.) and determine how close they are to the resultant by using a function similar to $(x^2-1)/(x^2+1)$, and then for each one of the different inputs add the result of the function to the fitness. That didn't seem to work well.
I can't seem to find any information online on the best methods for creating a fitness function, so I wasn't sure if there is some sort of guideline/equation to follow. Any information will help. Thank you.