📜 ⬆️ ⬇️

HabraWar - python-robots

Draft tech play for programmers. (very dirty, published to collect opinions and comments, do not minus much, please) Based on
habrahabr.ru/blogs/sport_programming/74536
and
habrahabr.ru/blogs/sport_programming/74523
Ready in general engine. The game is turn-based, the interface to the player programs is STDIN STDOUT, i.e. you can use any programming language (even brainfuck, if it supports I / O.)
There will be a gui-tester on wxPython (Linux / Windows / OSX) and a site with the ability to download your scripts or binaries, a player rating system (including by code execution time). Command battles and sdk are planned for several languages.
Everything (including the site) will be under the GPL and non-profit.
Disagsers and flashers are invited.

Ps . Do not judge strictly, written absolute absolute by the runner literally overnight, influenced by the discussion on the desktop. Better support with advice and commit
Update: Wrote a working description of the input / output format of player programs
UPD Here lies the approximate unfinished sdk, the bot code on the python will be like this:

Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  1. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  2. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  3. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  4. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  5. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  6. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  7. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  8. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  9. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  10. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  11. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  12. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  13. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  14. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  15. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  16. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  17. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  18. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  19. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  20. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  21. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()
  22. Copy Source | Copy HTML #!/usr/bin/python """Sample game bot for python-robots""" import pyr-sdk class DumbBoot (pyr-sdk.Pobot): def main (self): """Main cyclic function: :))""" for enemyrobot in self .robots: if self .GetDistToRobot(enemyrobot)< 4 : self .FireToRobot(enemyrobot) if self .energy< 50 : self .KillYMySelf() if not self .isWallAhead(): self .Go() else : self .Left() ###########common part self .reloading() def start (self): """some code which run once""" pass if __name__== "__main__" : darvin_small_metal_guy = DumbBoot ()

')

Source: https://habr.com/ru/post/74550/


All Articles