Play a game and learn to code!
Code. Fight. Win.
TechTanks is a programming game where you get to code your own tank and fight others! It's a great way to get started with programming and learn Ruby.
Tank brains are written in the Ruby programming language with simple commands to let you control interactions. Tanks can scan for other tanks using a radar, control their heading and their gun's heading, and can shoot at variable strengths and speeds. The more frequently shots are fired, the less powerful the shot.
#Example code class Circle < RTanque::Bot::Brain def tick! make_circles command.fire 0.25 end def make_circles command.speed = RTanque::Bot::BrainHelper::MAX_BOT_SPEED command.heading = sensors.heading + RTanque::Heading.new_from_degrees(85) command.turret_heading = sensors.turret_heading - RTanque::Heading.new_from_degrees(35) end end
Rules of the game are simple: Last bot standing wins. Gameplay is also pretty simple. Each tank has a base, turret and radar, each of which rotate independently. The base moves the tank, the turret has a gun mounted to it which can fire at other tanks, and the radar detects other tanks in its field of vision.