A tank war strategy built by NetLogo. Share your ideas and strategies and win the game!
Want to have a try? See demo.
You can see two kinds of tank here:
- The Red one
- The Blue one
In this project, the red tank has a temporary strongest strategy, which means it is very strong and you may lose it easily. You can not modify the code of the red one, but you can modify the blue one, and make it better than the red one.
If you have made your blue tank stronger than the red tank, You win!
You can submit your tank strategy (yours blue tank code) through a pull request, and we will update our red tank code according to your blue tank code until there is another better blue tank to beat yours. During this time, your github id and avatar will displaied in the
It's like a game of fighting, let's cheer, the first place is yours!
You can checkout for more information at it's homepage.
Here is the definition of NetLogo programming language from wikipedia:
NetLogo was designed, by Uri Wilensky, in the spirit of the Logo programming language, to be "low threshold and no ceiling". It teaches programming concepts using agents in the form of turtles, patches, links and the observer. NetLogo was designed for multiple audiences in mind, in particular: teaching children in the education community, and for domain experts without a programming background to model related phenomena. Many scientific articles have been published using NetLogo.
After all, it's a very easy programming language which can let you focus more on the programming logic of our battles.
How to get start?
- Install NetLogo in your machine or using the NetLogo Web.
- Open the
TankLogo.nlogofile (upload to the web server or double click in your computer).
- See the UI, and click the
setupbutton, and you can see the yellow boundary which means the wall.
- Type a name for the red tank (or the blue one) in the
TankName(input box), and click
- Type another name for the another tank in
TankName(input box), and click
create tankbutton to create it.
- Use button
runto begin the battle, use
resetbutton to restart a game.
The Tank Battle Strategy
Introduction to the UI:
setupbutton: Initialize the user interface.
resetbutton: Reset the war.
gobutton: Start animation and confrontation.
- You can use the
TankNameto put a name for your tank before creating it.
- You can set the
FirePowerthrough the progress bar, which is the power of per bullet.
- If you want to watch the track of tanks, you can set the
The finite element state machine was used for the core part of this tank war game. We set the default status to
status-random-forward[tickNum], they have diffierent characteristics and downsides:
- In the status
status-forward[v], the tank will use the
vas it's velocity to move forward.
- In status
status-stop, the tank will go back, turn right/left and just stop.
status-random-forward[tickNum]allows the tank to move forward at a random direction in a fixed time interval, which is can be set by input paramemter
status-dodge-forward[args]is a pretty tricky status, if other tank shooting by aiming at your tank, the best dodge strategy is to move in a direction perpendicular to its direction of motion, since the bullet has a delay before hitting yours.
The NetLogo is a pretty easy programming language, we wish you can get start as soon as possible, so if you have any question about NetLogo, please check out for the official document.
In this project, the only area you can modify are marked in the code via comments, you cannot make any changes related to the red tank, or we wouldn't accept your PR and update yours strategy.
In your code, you can not modify the opponent's attributes, such as resetting the health and velocity of the red tank, but you can detect others' attributes. For example, you can detect the patch of the red code using
To do some contributions, you need to install NetLogo firstly then clone your fork, double click the
TankLogo.nlogo and run!
Why choose NetLogo as programming language?
Because NetLogo is quite easy and there are less people know how to use it than other languages, so if you want to get start, everybody is equal.
How can I get start ?
Two steps, the first is install NetLogo. The second one is clone this repo and double click the
.nlogofile and improve the tank.
How can I get if I win your tank ?
The best tank will update according to your solution, and your Github avatar and name will display until somebody beats yours.
How to submit my solution ?
Fork this repo and improve your code, test if it can really win the red tank, submit a pull request, done!
If I don't want to install NetLogo, how can I get start?
You can use NetLogo Web to run your code.
Copyright 2018 Yizheng Huang Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.