Skip to content

Commit b3cde8e

Browse files
Merge branch 'master' of github.com:cameronangliss/poke-env into doubles-env
2 parents 7b1777a + 664840d commit b3cde8e

34 files changed

+3096
-463
lines changed

docs/source/examples/rl_with_gymnasium_wrapper.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Now that our custom class is defined, we can instantiate our RL player and test
122122
123123
opponent = RandomPlayer(battle_format="gen8randombattle")
124124
test_env = SimpleRLPlayer(
125-
battle_format="gen8randombattle", opponent=opponent, start_challenging=True
125+
battle_format="gen8randombattle", opponent=opponent
126126
)
127127
check_env(test_env)
128128
test_env.close()
@@ -135,8 +135,6 @@ Instantiating train environment and evaluation environment
135135
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136136

137137
Normally, to ensure isolation between training and testing, two different environments are created.
138-
If you don't want the player to start challenging the opponent you can set ``start_challenging=False`` when creating it.
139-
In this case, we want them to start challenging right away:
140138

141139
.. code-block:: python
142140
@@ -145,11 +143,11 @@ In this case, we want them to start challenging right away:
145143
146144
opponent = RandomPlayer(battle_format="gen8randombattle")
147145
train_env = SimpleRLPlayer(
148-
battle_format="gen8randombattle", opponent=opponent, start_challenging=True
146+
battle_format="gen8randombattle", opponent=opponent
149147
)
150148
opponent = RandomPlayer(battle_format="gen8randombattle")
151149
eval_env = SimpleRLPlayer(
152-
battle_format="gen8randombattle", opponent=opponent, start_challenging=True
150+
battle_format="gen8randombattle", opponent=opponent
153151
)
154152
...
155153

examples/env_example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def embed_battle(self, battle: AbstractBattle):
3636
if __name__ == "__main__":
3737
gymnasium_env = TestEnv(
3838
battle_format="gen8randombattle",
39-
start_challenging=True,
4039
)
4140
parallel_api_test(gymnasium_env)
4241
gymnasium_env.close()

examples/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
tensorflow<2.19
1+
tensorflow<2.20
22
keras-rl2

examples/rl_with_gymnasium_wrapper.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,15 @@ async def main():
7878
# First test the environment to ensure the class is consistent
7979
# with the Gymnasium API
8080
opponent = RandomPlayer(battle_format="gen8randombattle")
81-
test_env = SimpleRLPlayer(
82-
battle_format="gen8randombattle", start_challenging=True, opponent=opponent
83-
)
81+
test_env = SimpleRLPlayer(battle_format="gen8randombattle", opponent=opponent)
8482
check_env(test_env)
8583
test_env.close()
8684

8785
# Create one environment for training and one for evaluation
8886
opponent = RandomPlayer(battle_format="gen8randombattle")
89-
train_env = SimpleRLPlayer(
90-
battle_format="gen8randombattle", opponent=opponent, start_challenging=True
91-
)
87+
train_env = SimpleRLPlayer(battle_format="gen8randombattle", opponent=opponent)
9288
opponent = RandomPlayer(battle_format="gen8randombattle")
93-
eval_env = SimpleRLPlayer(
94-
battle_format="gen8randombattle", opponent=opponent, start_challenging=True
95-
)
89+
eval_env = SimpleRLPlayer(battle_format="gen8randombattle", opponent=opponent)
9690

9791
# Compute dimensions
9892
n_action = train_env.action_space.n

fixture_data/teams.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"packed-format": "zuzu|azumarill|aguavberry|hugepower|aquajet,bellydrum,return,playrough|Adamant|44,252,18,4,18,172|F||S|67|211]metal bird|celesteela|leftovers|beastboost|protect,rockslide,heavyslam,leechseed|Impish|252,,72,,184,||,,,0,9,20|||144]Garchomp||choiceband|roughskin|rockslide,earthpower,outrage,aquatail|Jolly|8,252,,,,248|||S||]Greninja||choicespecs|protean|scald,icebeam,darkpulse,extrasensory|Timid|4,,,252,,252|M|29,0,3,6,21,23|||]Heatran||assaultvest|flashfire|overheat,flamethrower,flashcannon,earthpower|Modest|252,,,252,,4||,0,,,26,|||,Ice,]kaaaaaaa|kartana|focussash|beastboost|leafblade,sacredsword,swordsdance,xscissor|Jolly|4,252,,,,252||||62|200"
8484
}
8585
],
86-
"gen9vgc2025regg": [
86+
"gen9vgc2025regi": [
8787
{
8888
"showdown-file": "beastcoasttt-413XPlayz.showdown",
8989
"packed-format": "Iron Hands||assaultvest|quarkdrive|fakeout,drainpunch,wildcharge,heavyslam|Adamant|4,156,4,,252,92||||50|,,,,,Water]Flutter Mane||boosterenergy|protosynthesis|moonblast,shadowball,icywind,protect|Timid|4,,196,148,4,156||,0,,,,||50|,,,,,Fairy]Landorus-Therian||choicescarf|intimidate|stompingtantrum,terablast,rockslide,uturn|Adamant|132,116,4,,4,252||||50|,,,,,Flying]Ogerpon-Wellspring||wellspringmask|waterabsorb|spikyshield,ivycudgel,hornleech,followme|Adamant|252,76,100,,12,68|F|||50|,,,,,Water]Chi-Yu||choicespecs|beadsofruin|heatwave,darkpulse,snarl,overheat|Timid|132,,4,108,12,252||,0,,,,||50|,,,,,Ghost]Sinistcha||rockyhelmet|hospitality|matchagotcha,ragepowder,trickroom,strengthsap|Bold|252,,252,4,,||,0,,,,||50|,,,,,Fairy"

integration_tests/test_env.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ def test_env_run():
5353
env = SinglesTestEnv(
5454
battle_format=f"gen{gen}randombattle",
5555
log_level=25,
56-
start_challenging=False,
5756
strict=False,
5857
)
59-
env.start_challenging(10)
6058
play_function(env, 10)
6159
env.close()
6260
for gen in range(8, 10):
@@ -87,11 +85,9 @@ def test_single_agent_env_run():
8785
env = SinglesTestEnv(
8886
battle_format=f"gen{gen}randombattle",
8987
log_level=25,
90-
start_challenging=False,
9188
strict=False,
9289
)
9390
env = SingleAgentWrapper(env, RandomPlayer())
94-
env.env.start_challenging(10)
9591
single_agent_play_function(env, 10)
9692
env.close()
9793
for gen in range(8, 10):
@@ -112,23 +108,17 @@ def test_repeated_runs():
112108
env = SinglesTestEnv(
113109
battle_format="gen8randombattle",
114110
log_level=25,
115-
start_challenging=False,
116111
strict=False,
117112
)
118-
env.start_challenging(2)
119113
play_function(env, 2)
120-
env.start_challenging(2)
121114
play_function(env, 2)
122115
env.close()
123116
env = SinglesTestEnv(
124117
battle_format="gen9randombattle",
125118
log_level=25,
126-
start_challenging=False,
127119
strict=False,
128120
)
129-
env.start_challenging(2)
130121
play_function(env, 2)
131-
env.start_challenging(2)
132122
play_function(env, 2)
133123
env.close()
134124

@@ -139,7 +129,6 @@ def test_env_api():
139129
env = SinglesTestEnv(
140130
battle_format=f"gen{gen}randombattle",
141131
log_level=25,
142-
start_challenging=True,
143132
strict=False,
144133
)
145134
parallel_api_test(env)
@@ -161,7 +150,6 @@ def test_single_agent_env_api():
161150
env = SinglesTestEnv(
162151
battle_format=f"gen{gen}randombattle",
163152
log_level=25,
164-
start_challenging=True,
165153
strict=False,
166154
)
167155
env = SingleAgentWrapper(env, RandomPlayer())

out.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3652,7 +3652,7 @@
36523652
"pp": 15,
36533653
"priority": 0,
36543654
"flags": { "protect": 1, "mirror": 1, "sound": 1, "bypasssub": 1, "metronome": 1 },
3655-
"onTry": "onTry",
3655+
"onTryMove": "onTryMove",
36563656
"condition": {
36573657
"duration": 2,
36583658
"onFieldStart": "onFieldStart",
@@ -13878,7 +13878,6 @@
1387813878
"priority": 0,
1387913879
"flags": { "protect": 1, "mirror": 1, "sound": 1, "bypasssub": 1, "metronome": 1 },
1388013880
"secondary": {
13881-
"dustproof": true,
1388213881
"chance": 100,
1388313882
"volatileStatus": "sparklingaria"
1388413883
},

src/poke_env/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import logging
44

5+
import poke_env.calc as calc
56
import poke_env.environment as environment
67
import poke_env.exceptions as exceptions
78
import poke_env.player as player
@@ -42,6 +43,7 @@
4243
"ShowdownException",
4344
"ShowdownServerConfiguration",
4445
"SimpleHeuristicsPlayer",
46+
"calc",
4547
"compute_raw_stats",
4648
"cross_evaluate",
4749
"environment",

src/poke_env/calc/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from poke_env.calc import damage_calc_gen9
2+
from poke_env.calc.damage_calc_gen9 import calculate_base_power, calculate_damage
3+
4+
__all__ = [
5+
"damage_calc_gen9",
6+
"calculate_damage",
7+
"calculate_base_power",
8+
]

0 commit comments

Comments
 (0)