forked from MarcinKorcz101/mk-ai-agents
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,043 additions
and
572 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,31 +1,37 @@ | ||
import streamlit as st | ||
import time | ||
from game.game_engine import GameEngine | ||
from game.models.player_human import HumanPlayer | ||
from game.models.player_ai import AIPlayer | ||
from game.models.game_models import PlayerRole | ||
from game.gui.debug_gui import DebugGUI | ||
|
||
game = GameEngine() | ||
|
||
model_name = "gpt-4o-mini" | ||
# model_name = "gemini-1.5-flash" | ||
|
||
# impostor = HumanPlayer(name="Warcin") | ||
impostor = AIPlayer(name="Warcin", llm_model_name=model_name, role=PlayerRole.IMPOSTOR) | ||
|
||
players = [ | ||
# AIPlayer(name="Wateusz", llm_model_name=model_name), | ||
# AIPlayer(name="Waciej", llm_model_name=model_name), | ||
AIPlayer(name="Warek", llm_model_name=model_name), | ||
AIPlayer(name="Wikolaj", llm_model_name=model_name), | ||
impostor, | ||
] | ||
game.load_players(players, impostor_count=1) | ||
game.init_game() | ||
|
||
game.DEBUG = True | ||
game.save_playthrough = f"whole_game_test__new_1.txt" | ||
gui = DebugGUI(game) | ||
game.gui = gui | ||
game.main_game_loop() | ||
gui.run() | ||
from game.players.human import HumanPlayer | ||
from game.players.ai import AIPlayer | ||
from game.players.base_player import PlayerRole | ||
|
||
def main(): | ||
st.title("Among Us Game - Streamlit") | ||
game_engine = GameEngine() | ||
|
||
model_name = "gpt-4o-mini" # Or any other suitable model name | ||
|
||
player_names = ["Wateusz", "Waciej", "Warek"] | ||
players = [AIPlayer(name=player_names[i], llm_model_name=model_name) for i in range(3)] | ||
game_engine.load_players(players, impostor_count=1) | ||
game_engine.init_game() | ||
|
||
player_states_placeholder = st.empty() | ||
game_log_placeholder = st.empty() | ||
|
||
try: | ||
game_engine.enter_main_game_loop() | ||
while True: | ||
# player_states = {player.name: player.to_dict() for player in game_engine.state.players} | ||
game_state = game_engine.to_dict() | ||
player_states_placeholder.json(game_state, expanded=False) | ||
game_log_placeholder.text("\n".join(game_engine.state.playthrough)) | ||
time.sleep(0.1) # Update every 100 milliseconds | ||
|
||
except Exception as e: | ||
print(f"Error updating GUI: {e}") | ||
st.error(f"An error occurred: {e}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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
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
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
Oops, something went wrong.