Skip to content

Commit f88934e

Browse files
committed
refactor: mv proejct to python package structure
1 parent 3d41d96 commit f88934e

File tree

18 files changed

+138
-2203
lines changed

18 files changed

+138
-2203
lines changed

balatrobot.lua

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,13 @@ BALATRO_BOT_CONFIG = {
2424
frame_ratio = 1,
2525
}
2626

27-
-- External libraries
28-
---@type List
29-
assert(SMODS.load_file("lib/list.lua"))()
30-
---@type Hook
31-
assert(SMODS.load_file("lib/hook.lua"))()
32-
---@type table
33-
assert(SMODS.load_file("lib/bitser.lua"))()
34-
---@type table
35-
assert(SMODS.load_file("lib/sock.lua"))()
36-
37-
-- Mod specific files
38-
---@type Utils
39-
assert(SMODS.load_file("src/utils.lua"))()
40-
---@type Bot
41-
assert(SMODS.load_file("src/bot.lua"))()
42-
---@type Middleware
43-
assert(SMODS.load_file("src/middleware.lua"))()
44-
---@type Botlogger
45-
assert(SMODS.load_file("src/botlogger.lua"))()
46-
---@type BalatrobotAPI
47-
assert(SMODS.load_file("src/api.lua"))()
27+
assert(SMODS.load_file("src/lua/list.lua"))()
28+
assert(SMODS.load_file("src/lua/hook.lua"))()
29+
assert(SMODS.load_file("src/lua/utils.lua"))()
30+
assert(SMODS.load_file("src/lua/bot.lua"))()
31+
assert(SMODS.load_file("src/lua/middleware.lua"))()
32+
assert(SMODS.load_file("src/lua/botlogger.lua"))()
33+
assert(SMODS.load_file("src/lua/api.lua"))()
4834

4935
-- Init middleware
5036
Middleware.hookbalatro()

bot_example.py

Lines changed: 0 additions & 98 deletions
This file was deleted.
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
# my_first_bot.py
2-
from bot import Actions, Bot
1+
import itertools
2+
3+
from balatrobot import Actions, Bot
4+
5+
plays = itertools.cycle(
6+
[
7+
# This sequence of plays is winning for the first round
8+
# for the seed "EXAMPLE" and the deck "Red Deck" with stake 1.
9+
[Actions.DISCARD_HAND, [2, 3, 4, 6]],
10+
[Actions.DISCARD_HAND, [1, 2, 6, 8]],
11+
[Actions.PLAY_HAND, [2, 3, 5, 6, 7]],
12+
[Actions.PLAY_HAND, [3, 4, 7, 8]],
13+
]
14+
)
315

416

517
class MyFirstBot(Bot):
6-
def __init__(self, deck="Red Deck", stake=1):
7-
super().__init__(deck=deck, stake=stake, seed="EXAMPLE")
18+
def __init__(self, deck="Red Deck", stake=1, seed="EXAMPLE"):
19+
super().__init__(deck=deck, stake=stake, seed=seed)
820
self.round_count = 0
921

1022
def skip_or_select_blind(self, G):
@@ -13,7 +25,7 @@ def skip_or_select_blind(self, G):
1325

1426
def select_cards_from_hand(self, G):
1527
"""Simple strategy: play the first card"""
16-
return [Actions.PLAY_HAND, [1]]
28+
return next(plays)
1729

1830
def select_shop_action(self, G):
1931
"""Always leave the shop immediately"""
@@ -48,8 +60,4 @@ def rearrange_hand(self, G):
4860
if __name__ == "__main__":
4961
bot = MyFirstBot()
5062
bot.running = True
51-
print("Starting MyFirstBot...")
52-
print("Running: ", bot.running)
53-
while True:
54-
input("Press Enter to simulate a game step...")
55-
bot.run_step()
63+
bot.run()

flush_bot.py

Lines changed: 0 additions & 137 deletions
This file was deleted.

gamestates.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)