HuskyDoge commited on
Commit
6b8ff79
β€’
1 Parent(s): 9e90422

fixed some bugs

Browse files
const.py CHANGED
@@ -43,6 +43,12 @@ _PLAYER_COLOR_AI_VS_AI = {
43
  _BLANK: "Blank",
44
  _BLACK: "BLACK",
45
  }
 
 
 
 
 
 
46
  _HORIZONTAL = np.array(
47
  [
48
  [0, 0, 0, 0, 0],
 
43
  _BLANK: "Blank",
44
  _BLACK: "BLACK",
45
  }
46
+
47
+ _PLAYER_COLOR = {
48
+ _WHITE: "WHITE",
49
+ _BLANK: "Blank",
50
+ _BLACK: "BLACK",
51
+ }
52
  _HORIZONTAL = np.array(
53
  [
54
  [0, 0, 0, 0, 0],
pages/AI_VS_AI.py CHANGED
@@ -20,6 +20,9 @@ from Gomoku_Bot import Board as Gomoku_bot_board
20
 
21
  import matplotlib.pyplot as plt
22
 
 
 
 
23
  from const import (
24
  _BLACK, # 1, for human
25
  _WHITE, # 2 , for AI
@@ -222,10 +225,10 @@ GAME_INFO.markdown(
222
  """
223
  ---
224
  # <span style="color:black;">Freestyle Gomoku game. 🎲</span>
 
 
225
  - no restrictions 🚫
226
  - no regrets 😎
227
- - no regrets 😎
228
- - swap players after one round is over πŸ”
229
  Powered by an AlphaZero approach with our own improvements! πŸš€ For the specific details, please check out our <a href="insert_report_link_here" style="color:blue;">report</a>.
230
  ##### Adapted and improved by us! 🌟 <a href="https://github.com/Lijiaxin0111/AI_3603_BIGHOME" style="color:blue;">Our Github repo</a>
231
  """,
@@ -661,8 +664,8 @@ def gomoku():
661
  while session_state.ROOM.WINNER == _BLANK:
662
  game_control()
663
  update_info()
664
- SCORE_PLATE[0].metric("Gomoku-Agent", session_state.ROOM.HISTORY[0])
665
- SCORE_PLATE[1].metric("Black", session_state.ROOM.HISTORY[1])
666
 
667
  if __name__ == "__main__":
668
  gomoku()
 
20
 
21
  import matplotlib.pyplot as plt
22
 
23
+ # refresh session state when changing pages
24
+
25
+
26
  from const import (
27
  _BLACK, # 1, for human
28
  _WHITE, # 2 , for AI
 
225
  """
226
  ---
227
  # <span style="color:black;">Freestyle Gomoku game. 🎲</span>
228
+ - FixedModel means you are not allowed to change model during a game
229
+ - LeaderBoard is still in development
230
  - no restrictions 🚫
231
  - no regrets 😎
 
 
232
  Powered by an AlphaZero approach with our own improvements! πŸš€ For the specific details, please check out our <a href="insert_report_link_here" style="color:blue;">report</a>.
233
  ##### Adapted and improved by us! 🌟 <a href="https://github.com/Lijiaxin0111/AI_3603_BIGHOME" style="color:blue;">Our Github repo</a>
234
  """,
 
664
  while session_state.ROOM.WINNER == _BLANK:
665
  game_control()
666
  update_info()
667
+ SCORE_PLATE[0].metric("Gomoku-Agent1", session_state.ROOM.HISTORY[0])
668
+ SCORE_PLATE[1].metric("Gomoku-Agent2", session_state.ROOM.HISTORY[1])
669
 
670
  if __name__ == "__main__":
671
  gomoku()
pages/{test.py β†’ FixedModel.py} RENAMED
@@ -20,6 +20,7 @@ from Gomoku_Bot import Board as Gomoku_bot_board
20
 
21
  import matplotlib.pyplot as plt
22
 
 
23
  from const import (
24
  _BLACK, # 1
25
  _WHITE, # 2
@@ -179,10 +180,10 @@ GAME_INFO.markdown(
179
  """
180
  ---
181
  # <span style="color:black;">Freestyle Gomoku game. 🎲</span>
 
 
182
  - no restrictions 🚫
183
  - no regrets 😎
184
- - no regrets 😎
185
- - swap players after one round is over πŸ”
186
  Powered by an AlphaZero approach with our own improvements! πŸš€ For the specific details, please check out our <a href="insert_report_link_here" style="color:blue;">report</a>.
187
  ##### Adapted and improved by us! 🌟 <a href="https://github.com/Lijiaxin0111/AI_3603_BIGHOME" style="color:blue;">Our Github repo</a>
188
  """,
 
20
 
21
  import matplotlib.pyplot as plt
22
 
23
+
24
  from const import (
25
  _BLACK, # 1
26
  _WHITE, # 2
 
180
  """
181
  ---
182
  # <span style="color:black;">Freestyle Gomoku game. 🎲</span>
183
+ - FixedModel means you are not allowed to change model during a game
184
+ - LeaderBoard is still in development
185
  - no restrictions 🚫
186
  - no regrets 😎
 
 
187
  Powered by an AlphaZero approach with our own improvements! πŸš€ For the specific details, please check out our <a href="insert_report_link_here" style="color:blue;">report</a>.
188
  ##### Adapted and improved by us! 🌟 <a href="https://github.com/Lijiaxin0111/AI_3603_BIGHOME" style="color:blue;">Our Github repo</a>
189
  """,
pages/{Try.py β†’ LeaderBoard.py} RENAMED
File without changes
pages/Player_VS_AI.py CHANGED
@@ -51,6 +51,8 @@ _PLAYER_SYMBOL = [0, _PLAYER_SYMBOL1, _PLAYER_SYMBOL2]
51
  # '''
52
 
53
 
 
 
54
  if "FirstPlayer" not in session_state:
55
  session_state.FirstPlayer = _BLACK
56
  session_state.Player = [[], [ _BLACK,_WHITE], [_WHITE,_BLACK]][session_state.FirstPlayer]
@@ -185,10 +187,10 @@ GAME_INFO.markdown(
185
  """
186
  ---
187
  # <span style="color:black;">Freestyle Gomoku game. 🎲</span>
 
 
188
  - no restrictions 🚫
189
  - no regrets 😎
190
- - no regrets 😎
191
- - swap players after one round is over πŸ”
192
  Powered by an AlphaZero approach with our own improvements! πŸš€ For the specific details, please check out our <a href="insert_report_link_here" style="color:blue;">report</a>.
193
  ##### Adapted and improved by us! 🌟 <a href="https://github.com/Lijiaxin0111/AI_3603_BIGHOME" style="color:blue;">Our Github repo</a>
194
  """,
@@ -662,7 +664,7 @@ def gomoku():
662
  def update_info() -> None:
663
  # Additional information
664
  SCORE_PLATE[0].metric("Gomoku-Agent", session_state.ROOM.HISTORY[0])
665
- SCORE_PLATE[1].metric("Black", session_state.ROOM.HISTORY[1])
666
  if session_state.ROOM.WINNER != _BLANK:
667
  st.balloons()
668
  ROUND_INFO.write(
 
51
  # '''
52
 
53
 
54
+
55
+
56
  if "FirstPlayer" not in session_state:
57
  session_state.FirstPlayer = _BLACK
58
  session_state.Player = [[], [ _BLACK,_WHITE], [_WHITE,_BLACK]][session_state.FirstPlayer]
 
187
  """
188
  ---
189
  # <span style="color:black;">Freestyle Gomoku game. 🎲</span>
190
+ - FixedModel means you are not allowed to change model during a game
191
+ - LeaderBoard is still in development
192
  - no restrictions 🚫
193
  - no regrets 😎
 
 
194
  Powered by an AlphaZero approach with our own improvements! πŸš€ For the specific details, please check out our <a href="insert_report_link_here" style="color:blue;">report</a>.
195
  ##### Adapted and improved by us! 🌟 <a href="https://github.com/Lijiaxin0111/AI_3603_BIGHOME" style="color:blue;">Our Github repo</a>
196
  """,
 
664
  def update_info() -> None:
665
  # Additional information
666
  SCORE_PLATE[0].metric("Gomoku-Agent", session_state.ROOM.HISTORY[0])
667
+ SCORE_PLATE[1].metric("Human", session_state.ROOM.HISTORY[1])
668
  if session_state.ROOM.WINNER != _BLANK:
669
  st.balloons()
670
  ROUND_INFO.write(