genetic-algorithm

Clarification on a Neural Net that plays Snake

江枫思渺然 提交于 2019-11-26 03:25:33
问题 I\'m new to neural networks/machine learning/genetic algorithms, and for my first implementation I am writing a network that learns to play snake (An example in case you haven\'t played it before) I have a few questions that I don\'t fully understand: Before my questions I just want to make sure I understand the general idea correctly. There is a population of snakes, each with randomly generated DNA. The DNA is the weights used in the neural network. Each time the snake moves, it uses the

How to perform a bitwise operation on floating point numbers

若如初见. 提交于 2019-11-26 00:54:14
问题 I tried this: float a = 1.4123; a = a & (1 << 3); I get a compiler error saying that the operand of & cannot be of type float. When I do: float a = 1.4123; a = (int)a & (1 << 3); I get the program running. The only thing is that the bitwise operation is done on the integer representation of the number obtained after rounding off. The following is also not allowed. float a = 1.4123; a = (void*)a & (1 << 3); I don\'t understand why int can be cast to void* but not float . I am doing this to

How to perform a bitwise operation on floating point numbers

烈酒焚心 提交于 2019-11-25 21:42:45
I tried this: float a = 1.4123; a = a & (1 << 3); I get a compiler error saying that the operand of & cannot be of type float. When I do: float a = 1.4123; a = (int)a & (1 << 3); I get the program running. The only thing is that the bitwise operation is done on the integer representation of the number obtained after rounding off. The following is also not allowed. float a = 1.4123; a = (void*)a & (1 << 3); I don't understand why int can be cast to void* but not float . I am doing this to solve the problem described in Stack Overflow question How to solve linear equations using a genetic