Skip to content

Commit

Permalink
created class diagram for ai
Browse files Browse the repository at this point in the history
  • Loading branch information
Timm Weber committed Mar 17, 2024
1 parent 5550b2c commit 5c1b89a
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions AI/class_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@startuml
title AI Strategy Pattern
skinparam classAttributeIconSize 0

class AIContext {
-_strategy: AIStrategy
+setStrategy(strategy: AIStrategy): None
+runStrategy(): Thread

}

abstract class AIStrategy {
-_strength: str
-_good_luck_message: str
-_good_game_message_lost: str
-_good_game_message_won: str
-_good_game_message_draw: str
-_current_uuid: str
-_rulebase: AIRulebase
-_ip: str
-_port: int
+post_init(): None
+thread_entry(): None
+run(): None
+join_game(): None
+message_handler(message_type: str): None
+wish_good_luck(): None
+say_good_game(): None
+get_empty_cells(game_status: list): list
+do_turn(): None
}

class WeakAIStrategy {
+do_turn(): None
}

class AdvancedAIStrategy {
+do_turn(): None
+check_winning_move(empty_cells: list, player: int): list|None
}

class AIRuleBase{

+check_win(game_state: GameState): None

}

class ABC{
--Python's Abstract Base Class--
}
class GameClient{
--The Client's GameClient--
}
class RuleBase{
--The Server's RuleBase--
}

AIContext --* AIStrategy
AIStrategy --|> ABC
AIStrategy --|> GameClient
AIStrategy --* AIRuleBase
AIRuleBase --|> RuleBase
AIStrategy <|-- WeakAIStrategy
AIStrategy <|-- AdvancedAIStrategy

@enduml

0 comments on commit 5c1b89a

Please sign in to comment.