Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in AI and Deep Learning by (50.2k points)

Specifically, I am talking about programming for this contest:

The contest involves you facing other teams with a swarm of spaceships in a two-dimensional world. The ships are constrained by a boundary (if they exit they die), and they must continually avoid moons (who pull the ships in with their gravity). The goal is to kill the opposing queen.

I have attempted to program a few, relatively basic techniques, but I feel as though I am missing something fundamental.

For example, I implemented some of the boids behaviors (, but they seemed to lack a... goal, so to speak.

Are there any common techniques (or, preferably, combinations of techniques) for this sort of game?


I would just like to open this up again with a bounty since I feel like I'm still missing critical pieces of information. The following is my NodeWar code:

boundary_field = (o, position)-> distance = ( - o.lib.vec.len(o.lib.vec.diff(position, 

return distance moon_field = (o, position) -> return o.lib.vec.len(o.lib.vec.diff(position, o.moons[0].pos)) 

ai.step = (o) -> torque = 0; 

thrust = 0; 

label = null; 

fields = [boundary_field, moon_field] # Total the potential fields and determine a target. 

target = [0, 0] 

score = -1000000 

step = 1 

square = 1 

for x in [(-square +[0])..

(square +[0])] by step for y in [(-square +[1])..(square +[1])] by step 

position = [x, y] 


if o.lib.vec.len(position) > 

value = ( (f) -> f(o, position)).reduce 

(t, s) -> t + s target = position 

if value > score 

score = value 

if value > score 

label = target 

{ torque, thrust } = o.lib.targeting.simpleTarget(, target) 

return { torque, thrust, label }

I may have implemented potential fields incorrectly, however, since all the examples I could find are about discrete movements (whereas NodeWar is continuous and not exact).

The main problem being my A.I. never stays within the game area for more than 10 seconds without flying off-screen or crashing into a moon.

1 Answer

0 votes
by (108k points)

You can easily make the boids algorithm play the game of Nodewar, by just adding additional steering behaviors to your boids and/or modifying the default ones. For example, you would add a steering behavior to avoid the moon, and a steering behavior for enemy ships (repulsion or attraction, depending on the position between yours and the enemy ship). The weights of the attraction/repulsion forces should then be tweaked (possibly by genetic algorithms, playing different configurations against each other).

I believe this approach would provide you a relatively strong baseline player, to which you can start adding collaborative strategies to it.

An ideal Bot platform offers

1. An NLP service — that you can train yourself.

2. SDK to support and handle conversations and their meta-data.

3. A Platform to host the bot code

4. A Platform to connect the Bot logic with multiple channels 

For more information regarding the Chat Bots , Designing Intents and Entities for your NLP Models, refer the following link:

Browse Categories