-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Poprawki tłumaczenia startegii podstawowej rg. Pierwsze klocki.
- Loading branch information
Showing
10 changed files
with
141 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import rg | ||
|
||
class Robot: | ||
|
||
def act(self, game): | ||
# jeżeli jesteśmy w środku, bronimy się w miejscu | ||
if self.location == rg.CENTER_POINT: | ||
return ['guard'] | ||
|
||
# jeżeli wokół są przeciwnicy, atakuj | ||
for loc, bot in game.robots.iteritems(): | ||
if bot.player_id != self.player_id: | ||
if rg.dist(loc, self.location) <= 1: | ||
return ['attack', loc] | ||
|
||
# idź do środka planszy | ||
return ['move', rg.toward(self.location, rg.CENTER_POINT)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#! /usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import rg | ||
|
||
class Robot: | ||
|
||
def act(self, game): | ||
# zbiory pól na planszy | ||
wszystkie = {(x, y) for x in xrange(19) for y in xrange(19)} | ||
wejscia = {loc for loc in wszystkie if 'spawn' in rg.loc_types(loc)} | ||
zablokowane = {loc for loc in wszystkie if 'obstacle' in rg.loc_types(loc)} | ||
druzyna = {loc for loc in game.robots if game.robots[loc].player_id == self.player_id} | ||
wrogowie = set(game.robots)-druzyna | ||
|
||
# jeżeli jesteśmy w środku, bronimy się w miejscu | ||
if self.location == rg.CENTER_POINT: | ||
return ['guard'] | ||
|
||
# jeżeli wokół są przeciwnicy, atakuj | ||
for loc, bot in game.robots.iteritems(): | ||
if bot.player_id != self.player_id: | ||
if rg.dist(loc, self.location) <= 1: | ||
return ['attack', loc] | ||
|
||
# idź do środka planszy | ||
return ['move', rg.toward(self.location, rg.CENTER_POINT)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# idź do środka planszy | ||
return ['move', rg.toward(self.location, rg.CENTER_POINT)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# jeżeli jesteś w środku, broń się w miejscu | ||
if self.location == rg.CENTER_POINT: | ||
return ['guard'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# jeżeli wokół są przeciwnicy, atakuj | ||
for loc, bot in game.robots.iteritems(): | ||
if bot.player_id != self.player_id: | ||
if rg.dist(loc, self.location) <= 1: | ||
return ['attack', loc] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# jeżeli wokół są przeciwnicy, atakuj | ||
for loc, bot in game.robots.iteritems(): | ||
if bot.player_id != self.player_id: | ||
if rg.dist(loc, self.location) <= 1: | ||
return ['attack', loc] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import rg | ||
|
||
class Robot: | ||
|
||
def act(self, game): | ||
# move toward the center | ||
return ['move', rg.toward(self.location, rg.CENTER_POINT)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import rg | ||
|
||
class Robot: | ||
|
||
def act(self, game): | ||
# jeżeli jesteś w środku, broń się w miejscu | ||
if self.location == rg.CENTER_POINT: | ||
return ['guard'] | ||
|
||
# idź do środka planszy | ||
return ['move', rg.toward(self.location, rg.CENTER_POINT)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import rg | ||
|
||
class Robot: | ||
|
||
def act(self, game): | ||
# jeżeli jesteś w środku, broń się w miejscu | ||
if self.location == rg.CENTER_POINT: | ||
return ['guard'] | ||
|
||
# jeżeli wokół są przeciwnicy, atakuj | ||
for loc, bot in game.robots.iteritems(): | ||
if bot.player_id != self.player_id: | ||
if rg.dist(loc, self.location) <= 1: | ||
return ['attack', loc] | ||
|
||
# idź do środka planszy | ||
return ['move', rg.toward(self.location, rg.CENTER_POINT)] |