I have a virtual world with a grid filled with squares (x by y). There are entities that can do:
1. move 1 step in the four cardinal directions
2. eat food
3. fight another entity of a different type
4. mate with the same type of entity to reproduce (create one more of that type of entity)

The objective is to obtain the highest score possible. The score is calculated by:
+1 per food eaten
+1 per enemy killed
+1 per entity of that type

The inputs (neurons) are as follows:
1. position (x, y) on board
2. board size
3. types of entities in adjacent squares (including food, and null if empty)

I would like to create a program that will create hidden neurons that give rise to a sophisticated moving and attacking pattern that will allow it to obtain the highest score.

Which algorithm should I use?

  • 1
    $\begingroup$ Welcome to Computer Science! What have you tried? Where did you get stuck? We do not want to just hand you the solution; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See here for tips on asking questions about exercise problems. If you are uncertain how to improve your question, why not ask around in Computer Science Chat? $\endgroup$
    – Raphael
    Mar 12, 2018 at 22:02
  • 2
    $\begingroup$ Note that programming is offtopic here. $\endgroup$
    – Raphael
    Mar 12, 2018 at 22:02
  • $\begingroup$ I think it is a good but subjective question: no one really knows which idea will work best before you go ahead and implement it. $\endgroup$
    – 6005
    Aug 10, 2018 at 1:17

1 Answer 1


I would suggest that you try to apply reinforcement learning, maybe deep Q-learning or some other form of RL.

I don't know if those are going to be the best set of features (the best way to represent the input).

  • $\begingroup$ Thank you for the reply! How would you allow the program to create intermediate neurons? $\endgroup$
    – randomuser
    Mar 12, 2018 at 22:00
  • $\begingroup$ @RandomPieKevin, I don't understand your question. You get to choose the neural network structure; you can make it whatever you want to be, and have as many or as few neurons as you want. You don't need a program to do that for you -- you can choose the neural network architecture yourself. $\endgroup$
    – D.W.
    Mar 13, 2018 at 0:15
  • $\begingroup$ I thought that true AI would create their intermediate neurons themselves; thus, the true learning. $\endgroup$
    – randomuser
    Mar 13, 2018 at 15:09
  • $\begingroup$ @RandomPieKevin, I don't know what you mean by "true AI" or "true learning", or where you got that idea from, but no, there's no reason why you need to be restricted to that, and that's not how machine learning is normally done. My answer certainly counts as learning and counts as AI; there's nothing fake or untrue about it. In any case, that restriction is not in the question, so if you have some additional requirements, I suggest you edit the question to clarify what your requirements are and what approaches you've already considered and rejected and why. $\endgroup$
    – D.W.
    Mar 13, 2018 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.