Skip to content

Commit 9ea0d89

Browse files
committed
Investigate now returns a tuple, renamed inv.._current_position to inv.._current
1 parent e6b536f commit 9ea0d89

File tree

9 files changed

+194
-151
lines changed

9 files changed

+194
-151
lines changed

docs/Game.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Pirates are the functional units of a team, that explore the map, collect resour
6060

6161
The primary action that a pirate can perform is to **move**, and to decide where to move it can investigate its surroundings and communicate with its team via signals.
6262

63-
Each ship occupies exactly one tile at any time, and any tile that has one or more ships from a team will have a boat displayed on it.
63+
Each pirate occupies exactly one tile at any time, and any tile that has one or more pirates from a team will have a ship displayed on it.
6464

6565
## 2. Communication Between Base and Robots
6666

docs/Pirate.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ def ActPirate(pirate):
1414

1515
## Investigation
1616

17-
A pirate is able to investigate all 8 tiles surrounding it, by which it can find out what lies in those tiles.
17+
A pirate is able to investigate the tile it is on, and all 8 tiles surrounding it, by which it can find out what lies in those tiles.
1818
Tiles are referred to based on their direction with respect to the pirate.
1919

2020
![The names used to refer to the tiles adjacent to the pirate](/docs/media/directions.jpg)
2121

22-
- **`investigate_current_position()`** : This function is used to investigate the current location of the pirate.
22+
- **`investigate_current()`** : This function is used to investigate the current location of the pirate.
2323

2424
- **`investigate_up()`** : This function is used to investigate the area above the current location of the pirate.
2525

@@ -37,12 +37,18 @@ Tiles are referred to based on their direction with respect to the pirate.
3737

3838
- **`investigate_sw()`** : This function is used to investigate the area in the southwest direction of the current location of the pirate.
3939

40-
Each of the above functions returns one of the following strings, corresponding to the contents of the investigated tile:
40+
Each of the above functions returns a tuple of two strings `(where, who)`, `where` representing the type of the tile, and `who` the presence of pirates:
41+
42+
`where` can take the following values:
4143
- ***'wall'*** if the tile is out of bounds
42-
- ***'friend'*** if a ship from the same team is on the tile
43-
- ***'enemy'*** if a ship from the other team is on the tile
4444
- ***'island1', 'island2' or 'island3'*** if the tile is a part of an island
45-
- ***'blank'*** in all other cases
45+
- ***'blank'*** in all other cases (<u>i.e.</u> the sea)
46+
47+
`who` can take the following values:
48+
- ***'friend'*** if only pirates from the same team are on the tile
49+
- ***'enemy'*** if only pirates from the other team are on the tile
50+
- ***'both'*** if pirates from both teams are on the tile
51+
- ***'blank'*** in all other cases (<u>i.e.</u> no pirates)
4652

4753
## Info
4854

@@ -61,6 +67,9 @@ Returns the position of the pirate as a tuple `(x, y)`.
6167
### `getDeployPoint()`
6268
Returns the coordinates of the deploy point of the team as a tuple `(x, y)`.
6369

70+
### `getID()`
71+
Returns a string that uniquely identifies a pirate from each team, corresponding to the order of its creation
72+
6473
### `getDimensionX()`
6574
Returns the X dimension of the game.
6675

@@ -69,9 +78,6 @@ Returns the Y dimension of the game.
6978

7079
## Signalling
7180

72-
### `GetInitialSignal()`
73-
Returns the initial signal of the pirate.
74-
7581
### `getSignal()`
7682
Returns the current signal of the pirate.
7783

docs/media/directions.jpg

185 KB
Loading

engine/island.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def __init__(self, screen, number, game, flag, pirate_map):
3030
for i in range(-1, 2):
3131
for j in range(-1, 2):
3232
self.coordi.append((self.__flag[0] + i, self.__flag[1] + j))
33-
self.__pirate_map[self.__flag[0] + j][self.__flag[1] + i] = number + 2
33+
self.__pirate_map[self.__flag[0] + j][self.__flag[1] + i] = number << 2
3434
self.__myTeamGame._Game__Pirates[self.__flag[0] + j][
3535
self.__flag[1] + i
36-
] = (number + 2)
36+
] |= number << 2
3737

3838
for coo in self.coordi:
3939
if coo != (self.__flag[0], self.__flag[1]):

0 commit comments

Comments
 (0)