ucsc-chessai 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. ucsc_chessai-0.0.0/.ci/build_site.sh +105 -0
  2. ucsc_chessai-0.0.0/.ci/html/css/style.css +18 -0
  3. ucsc_chessai-0.0.0/.ci/html/index.html +34 -0
  4. ucsc_chessai-0.0.0/.github/CODE_OF_CONDUCT.md +77 -0
  5. ucsc_chessai-0.0.0/.github/CONTRIBUTING.md +152 -0
  6. ucsc_chessai-0.0.0/.github/workflows/main.yml +152 -0
  7. ucsc_chessai-0.0.0/.gitignore +34 -0
  8. ucsc_chessai-0.0.0/.mypy.ini +9 -0
  9. ucsc_chessai-0.0.0/.pylintrc +663 -0
  10. ucsc_chessai-0.0.0/LICENSE +10 -0
  11. ucsc_chessai-0.0.0/LICENSE-code +21 -0
  12. ucsc_chessai-0.0.0/LICENSE-noncode +14 -0
  13. ucsc_chessai-0.0.0/PKG-INFO +196 -0
  14. ucsc_chessai-0.0.0/README.md +167 -0
  15. ucsc_chessai-0.0.0/chessai/__init__.py +5 -0
  16. ucsc_chessai-0.0.0/chessai/agents/__init__.py +4 -0
  17. ucsc_chessai-0.0.0/chessai/agents/aggressive.py +31 -0
  18. ucsc_chessai-0.0.0/chessai/agents/dummy.py +13 -0
  19. ucsc_chessai-0.0.0/chessai/agents/gaurd.py +21 -0
  20. ucsc_chessai-0.0.0/chessai/agents/greedy.py +30 -0
  21. ucsc_chessai-0.0.0/chessai/agents/minimax.py +236 -0
  22. ucsc_chessai-0.0.0/chessai/agents/multiscripted.py +83 -0
  23. ucsc_chessai-0.0.0/chessai/agents/pickfirst.py +11 -0
  24. ucsc_chessai-0.0.0/chessai/agents/random.py +21 -0
  25. ucsc_chessai-0.0.0/chessai/agents/scripted.py +31 -0
  26. ucsc_chessai-0.0.0/chessai/agents/searchproblem.py +146 -0
  27. ucsc_chessai-0.0.0/chessai/agents/testing.py +43 -0
  28. ucsc_chessai-0.0.0/chessai/agents/userinput.py +32 -0
  29. ucsc_chessai-0.0.0/chessai/chess/__init__.py +3 -0
  30. ucsc_chessai-0.0.0/chessai/chess/__main__.py +8 -0
  31. ucsc_chessai-0.0.0/chessai/chess/bin.py +64 -0
  32. ucsc_chessai-0.0.0/chessai/chess/game.py +19 -0
  33. ucsc_chessai-0.0.0/chessai/chess/game_test.py +272 -0
  34. ucsc_chessai-0.0.0/chessai/chess/gamestate.py +628 -0
  35. ucsc_chessai-0.0.0/chessai/chess/gamestate_test.py +436 -0
  36. ucsc_chessai-0.0.0/chessai/chess/piece.py +162 -0
  37. ucsc_chessai-0.0.0/chessai/core/__init__.py +4 -0
  38. ucsc_chessai-0.0.0/chessai/core/action.py +233 -0
  39. ucsc_chessai-0.0.0/chessai/core/action_test.py +624 -0
  40. ucsc_chessai-0.0.0/chessai/core/agent.py +188 -0
  41. ucsc_chessai-0.0.0/chessai/core/agentaction.py +74 -0
  42. ucsc_chessai-0.0.0/chessai/core/agentinfo.py +72 -0
  43. ucsc_chessai-0.0.0/chessai/core/board.py +250 -0
  44. ucsc_chessai-0.0.0/chessai/core/board_test.py +204 -0
  45. ucsc_chessai-0.0.0/chessai/core/castling.py +125 -0
  46. ucsc_chessai-0.0.0/chessai/core/coordinate.py +169 -0
  47. ucsc_chessai-0.0.0/chessai/core/coordinate_test.py +203 -0
  48. ucsc_chessai-0.0.0/chessai/core/game.py +761 -0
  49. ucsc_chessai-0.0.0/chessai/core/gameparser.py +714 -0
  50. ucsc_chessai-0.0.0/chessai/core/gameparser_test.py +313 -0
  51. ucsc_chessai-0.0.0/chessai/core/gamestate.py +820 -0
  52. ucsc_chessai-0.0.0/chessai/core/gamestate_test.py +83 -0
  53. ucsc_chessai-0.0.0/chessai/core/isolation/__init__.py +3 -0
  54. ucsc_chessai-0.0.0/chessai/core/isolation/isolator.py +58 -0
  55. ucsc_chessai-0.0.0/chessai/core/isolation/level.py +25 -0
  56. ucsc_chessai-0.0.0/chessai/core/isolation/none.py +103 -0
  57. ucsc_chessai-0.0.0/chessai/core/log.py +30 -0
  58. ucsc_chessai-0.0.0/chessai/core/parser.py +391 -0
  59. ucsc_chessai-0.0.0/chessai/core/parser_test.py +407 -0
  60. ucsc_chessai-0.0.0/chessai/core/piece.py +130 -0
  61. ucsc_chessai-0.0.0/chessai/core/search.py +182 -0
  62. ucsc_chessai-0.0.0/chessai/core/types.py +64 -0
  63. ucsc_chessai-0.0.0/chessai/core/types_test.py +47 -0
  64. ucsc_chessai-0.0.0/chessai/core/ui.py +120 -0
  65. ucsc_chessai-0.0.0/chessai/puzzle/__init__.py +3 -0
  66. ucsc_chessai-0.0.0/chessai/puzzle/__main__.py +8 -0
  67. ucsc_chessai-0.0.0/chessai/puzzle/bin.py +147 -0
  68. ucsc_chessai-0.0.0/chessai/puzzle/game.py +169 -0
  69. ucsc_chessai-0.0.0/chessai/puzzle/game_test.py +53 -0
  70. ucsc_chessai-0.0.0/chessai/puzzle/gamestate.py +77 -0
  71. ucsc_chessai-0.0.0/chessai/puzzle/parser.py +67 -0
  72. ucsc_chessai-0.0.0/chessai/resources/__init__.py +4 -0
  73. ucsc_chessai-0.0.0/chessai/resources/boards/__init__.py +3 -0
  74. ucsc_chessai-0.0.0/chessai/resources/boards/demichess.fen +1 -0
  75. ucsc_chessai-0.0.0/chessai/resources/boards/microchess.fen +1 -0
  76. ucsc_chessai-0.0.0/chessai/resources/boards/mini-silverman.fen +1 -0
  77. ucsc_chessai-0.0.0/chessai/resources/boards/standard.fen +1 -0
  78. ucsc_chessai-0.0.0/chessai/resources/games/__init__.py +3 -0
  79. ucsc_chessai-0.0.0/chessai/resources/games/black-checkmate.pgn +65 -0
  80. ucsc_chessai-0.0.0/chessai/resources/games/black-checkmate.pgn.gz +0 -0
  81. ucsc_chessai-0.0.0/chessai/resources/games/draw-accepted.pgn +20 -0
  82. ucsc_chessai-0.0.0/chessai/resources/games/stalemate.pgn +19 -0
  83. ucsc_chessai-0.0.0/chessai/resources/puzzles/__init__.py +3 -0
  84. ucsc_chessai-0.0.0/chessai/resources/puzzles/puzzle-base.json +6 -0
  85. ucsc_chessai-0.0.0/chessai/resources/puzzles/puzzle-mate-3.json +12 -0
  86. ucsc_chessai-0.0.0/chessai/resources/puzzles/puzzle-skewer.json +6 -0
  87. ucsc_chessai-0.0.0/chessai/resources/tours/__init__.py +3 -0
  88. ucsc_chessai-0.0.0/chessai/resources/tours/gaurded-tour.json +4 -0
  89. ucsc_chessai-0.0.0/chessai/resources/tours/king-defend.json +4 -0
  90. ucsc_chessai-0.0.0/chessai/resources/tours/king-simple.json +4 -0
  91. ucsc_chessai-0.0.0/chessai/resources/tours/large-rocks-2.json +4 -0
  92. ucsc_chessai-0.0.0/chessai/resources/tours/large-rocks.json +4 -0
  93. ucsc_chessai-0.0.0/chessai/resources/tours/maze-large.json +4 -0
  94. ucsc_chessai-0.0.0/chessai/resources/tours/maze-medium.json +4 -0
  95. ucsc_chessai-0.0.0/chessai/resources/tours/tour-attacked.json +4 -0
  96. ucsc_chessai-0.0.0/chessai/resources/tours/tour-base.json +4 -0
  97. ucsc_chessai-0.0.0/chessai/resources/tours/tour-multi.json +4 -0
  98. ucsc_chessai-0.0.0/chessai/resources/tours/tour-rocks.json +4 -0
  99. ucsc_chessai-0.0.0/chessai/search/__init__.py +5 -0
  100. ucsc_chessai-0.0.0/chessai/search/common.py +50 -0
  101. ucsc_chessai-0.0.0/chessai/search/distance.py +251 -0
  102. ucsc_chessai-0.0.0/chessai/search/distance_test.py +146 -0
  103. ucsc_chessai-0.0.0/chessai/search/position.py +130 -0
  104. ucsc_chessai-0.0.0/chessai/search/random.py +37 -0
  105. ucsc_chessai-0.0.0/chessai/search/tourbase.py +25 -0
  106. ucsc_chessai-0.0.0/chessai/student/__init__.py +6 -0
  107. ucsc_chessai-0.0.0/chessai/student/multiagents.py +101 -0
  108. ucsc_chessai-0.0.0/chessai/student/singlesearch.py +168 -0
  109. ucsc_chessai-0.0.0/chessai/test/__init__.py +3 -0
  110. ucsc_chessai-0.0.0/chessai/test/cli_test.py +15 -0
  111. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_base.txt +14 -0
  112. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_board.txt +15 -0
  113. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_board_target.txt +16 -0
  114. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_gaurd.txt +18 -0
  115. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_problem.txt +16 -0
  116. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_problem_astar.txt +20 -0
  117. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_problem_bfs.txt +20 -0
  118. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_problem_dfs.txt +20 -0
  119. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_problem_ucs.txt +20 -0
  120. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_rocks.txt +17 -0
  121. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment1_target.txt +15 -0
  122. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment2_alphabeta_debug.txt +70 -0
  123. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment2_expectimax_bettereval_debug.txt +71 -0
  124. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment2_expectimax_debug.txt +70 -0
  125. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment2_minimax.txt +16 -0
  126. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment2_minimax_debug.txt +69 -0
  127. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment2_minimax_ply4.txt +16 -0
  128. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/assignment2_reflex.txt +16 -0
  129. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/basedir_base.txt +15 -0
  130. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_aggressive.txt +16 -0
  131. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_base.txt +14 -0
  132. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_greedy.txt +16 -0
  133. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_max_moves.txt +14 -0
  134. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_num_games.txt +17 -0
  135. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_pickfirst.txt +16 -0
  136. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_random.txt +16 -0
  137. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_replay.txt +14 -0
  138. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_replay_draw.txt +14 -0
  139. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_chesstest_replay_gzip.txt +14 -0
  140. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_help.txt +9 -0
  141. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_load_board.txt +15 -0
  142. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_puzzletest_base.txt +14 -0
  143. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_puzzletest_black.txt +15 -0
  144. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_puzzletest_board.txt +15 -0
  145. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_puzzletest_loss.txt +15 -0
  146. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/chess_puzzletest_move_lines.txt +15 -0
  147. ucsc_chessai-0.0.0/chessai/test/testdata/cli/tests/timeout_none_action.txt +20 -0
  148. ucsc_chessai-0.0.0/chessai/tour/__init__.py +3 -0
  149. ucsc_chessai-0.0.0/chessai/tour/__main__.py +8 -0
  150. ucsc_chessai-0.0.0/chessai/tour/bin.py +124 -0
  151. ucsc_chessai-0.0.0/chessai/tour/game.py +68 -0
  152. ucsc_chessai-0.0.0/chessai/tour/gamestate.py +217 -0
  153. ucsc_chessai-0.0.0/chessai/tour/gamestate_test.py +59 -0
  154. ucsc_chessai-0.0.0/chessai/tour/parser.py +64 -0
  155. ucsc_chessai-0.0.0/chessai/tour/piece.py +42 -0
  156. ucsc_chessai-0.0.0/chessai/ui/__init__.py +3 -0
  157. ucsc_chessai-0.0.0/chessai/ui/null.py +15 -0
  158. ucsc_chessai-0.0.0/chessai/ui/text.py +169 -0
  159. ucsc_chessai-0.0.0/chessai/util/__init__.py +3 -0
  160. ucsc_chessai-0.0.0/chessai/util/alias.py +167 -0
  161. ucsc_chessai-0.0.0/chessai/util/alias_test.py +22 -0
  162. ucsc_chessai-0.0.0/chessai/util/bin.py +255 -0
  163. ucsc_chessai-0.0.0/chessai/util/comparable.py +54 -0
  164. ucsc_chessai-0.0.0/chessai/util/parse.py +31 -0
  165. ucsc_chessai-0.0.0/chessai/util/parse_test.py +71 -0
  166. ucsc_chessai-0.0.0/chessai/util/reflection.py +194 -0
  167. ucsc_chessai-0.0.0/chessai/util/reflection_test.py +201 -0
  168. ucsc_chessai-0.0.0/docs/development.md +26 -0
  169. ucsc_chessai-0.0.0/pyproject.toml +57 -0
  170. ucsc_chessai-0.0.0/requirements-dev.txt +6 -0
  171. ucsc_chessai-0.0.0/requirements.txt +1 -0
  172. ucsc_chessai-0.0.0/scripts/check_all.sh +50 -0
  173. ucsc_chessai-0.0.0/scripts/check_lint.sh +23 -0
  174. ucsc_chessai-0.0.0/scripts/check_python_version.sh +23 -0
  175. ucsc_chessai-0.0.0/scripts/check_strict_types.sh +23 -0
  176. ucsc_chessai-0.0.0/scripts/check_types.sh +23 -0
  177. ucsc_chessai-0.0.0/scripts/gen_docs.sh +35 -0
  178. ucsc_chessai-0.0.0/scripts/run_tests.sh +18 -0
  179. ucsc_chessai-0.0.0/scripts/test_game.py +21 -0
  180. ucsc_chessai-0.0.0/setup.cfg +4 -0
  181. ucsc_chessai-0.0.0/ucsc_chessai.egg-info/PKG-INFO +196 -0
  182. ucsc_chessai-0.0.0/ucsc_chessai.egg-info/SOURCES.txt +183 -0
  183. ucsc_chessai-0.0.0/ucsc_chessai.egg-info/dependency_links.txt +1 -0
  184. ucsc_chessai-0.0.0/ucsc_chessai.egg-info/requires.txt +9 -0
  185. ucsc_chessai-0.0.0/ucsc_chessai.egg-info/top_level.txt +1 -0
@@ -0,0 +1,105 @@
1
+ #!/bin/bash
2
+
3
+ # Create a full website including all documentation ready to be deployed.
4
+ # This script should only be done from a clean repo on the main branch.
5
+ # Documentation will be generated from the main branch (latest) as well as each version tag.
6
+
7
+ readonly THIS_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd | xargs realpath)"
8
+ readonly ROOT_DIR="${THIS_DIR}/.."
9
+ readonly TEMPLATE_HTML_DIR="${THIS_DIR}/html"
10
+ readonly BUILD_DIR="${ROOT_DIR}/html"
11
+ readonly BASE_OUT_DIR="${ROOT_DIR}/._site"
12
+ readonly DOCS_DIRNAME='docs'
13
+ readonly DOCS_OUT_DIR="${BASE_OUT_DIR}/${DOCS_DIRNAME}"
14
+ readonly GEN_DOCS_SCRIPT="${ROOT_DIR}/scripts/gen_docs.sh"
15
+
16
+ readonly MAIN_BRANCH="main"
17
+
18
+ readonly INDEX_TITLE_LOCATION='<header class="pdoc">'
19
+ readonly MODULE_TITLE_LOCATION='<section class="module-info">'
20
+
21
+ readonly API_DOC_MARKER='<!-- API-DOC-MARKER -->'
22
+
23
+ # Don't generate any docs for this version or earlier.
24
+ readonly ONLY_AFTER_TAG='v2.0.2'
25
+
26
+ function check_git() {
27
+ if [ ! -z "$(git status --porcelain)" ] ; then
28
+ echo "ERROR: Repository is not clean."
29
+ exit 1
30
+ fi
31
+
32
+ if [ $(git branch --show-current) != 'main' ] ; then
33
+ echo "ERROR: Repository is not on the main branch."
34
+ exit 2
35
+ fi
36
+
37
+ return 0
38
+ }
39
+
40
+ function gen_docs() {
41
+ local label=$1
42
+ local reference=$2
43
+
44
+ echo "Generating docs for '${label}'."
45
+
46
+ rm -rf "${BUILD_DIR}"
47
+ ${GEN_DOCS_SCRIPT}
48
+
49
+ # Add in the label to the landing pages.
50
+ local git_link="https://github.com/ucsc-cse-240/chessai/tree/${reference}"
51
+
52
+ local index_title="<h1 style='flex-grow: 1'>Chessai API Reference: <a href='${git_link}'>${label}</a></h1>"
53
+ sed -i "s#${INDEX_TITLE_LOCATION}#${INDEX_TITLE_LOCATION}${index_title}#" "${BUILD_DIR}/index.html"
54
+
55
+ local module_title="<h1>Chessai API Reference: <a href='${git_link}'>${label}</a></h1>"
56
+ sed -i "s#${MODULE_TITLE_LOCATION}#${MODULE_TITLE_LOCATION}${module_title}#" "${BUILD_DIR}/chessai.html"
57
+
58
+ # Moved the compiled documentation to the main site.
59
+ mkdir -p "${DOCS_OUT_DIR}"
60
+ mv "${BUILD_DIR}" "${DOCS_OUT_DIR}/${label}"
61
+
62
+ # Add this documentation to the main index page.
63
+ local index_li="<li><a href='${DOCS_DIRNAME}/${label}/index.html'>${label}</a></li>"
64
+ sed -i "s#${API_DOC_MARKER}#${index_li}${API_DOC_MARKER}#" "${BASE_OUT_DIR}/index.html"
65
+ }
66
+
67
+ function main() {
68
+ if [[ $# -ne 0 ]]; then
69
+ echo "USAGE: $0"
70
+ exit 1
71
+ fi
72
+
73
+ set -e
74
+ trap exit SIGINT
75
+
76
+ cd "${ROOT_DIR}"
77
+
78
+ # Remove any existing output.
79
+ rm -rf "${BASE_OUT_DIR}"
80
+ cp -r "${TEMPLATE_HTML_DIR}" "${BASE_OUT_DIR}"
81
+
82
+ # Ensure that the repo looks good.
83
+ check_git
84
+
85
+ # Generate the latest documentation.
86
+ local git_hash=$(git rev-parse --short HEAD)
87
+ gen_docs "latest (${git_hash})" "${git_hash}"
88
+
89
+ # Generate docs for each tagged version.
90
+ for tag in $(git tag -l | grep -P '^v\d+\.\d+\.\d+') ; do
91
+ if [[ ! "${tag}" > "${ONLY_AFTER_TAG}" ]] ; then
92
+ continue
93
+ fi
94
+
95
+ git checkout --quiet "${tag}"
96
+ gen_docs "${tag}" "${tag}"
97
+ done
98
+
99
+ # Move back to main.
100
+ git checkout --quiet main
101
+
102
+ return 0
103
+ }
104
+
105
+ [[ "${BASH_SOURCE[0]}" == "${0}" ]] && main "$@"
@@ -0,0 +1,18 @@
1
+ ul {
2
+ margin: 0;
3
+ }
4
+
5
+ h1, p {
6
+ margin: 0;
7
+ }
8
+
9
+ .page {
10
+ width: 100%;
11
+ height: 100%;
12
+ display: flex;
13
+ flex-direction: column;
14
+ flex-wrap: nowrap;
15
+ justify-content: flex-start;
16
+ align-items: center;
17
+ gap: 2em;
18
+ }
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset='utf-8'/>
5
+ <meta name='viewport' content='width=device-width, initial-scale=1.0'>
6
+
7
+ <title>Chessai</title>
8
+
9
+ <!-- <link rel="icon" href="images/favicon.ico"> -->
10
+
11
+ <link rel='stylesheet' type='text/css' href='css/style.css'>
12
+ </head>
13
+ <body>
14
+ <div class='page'>
15
+ <h1>chessai</h1>
16
+
17
+ <!-- <img src='images/pacman.webp' alt='Pac-Man Game' /> -->
18
+
19
+ <div class='overview'>
20
+ <p>Chessai is an AI educational project disguised as <a href='https://en.wikipedia.org/wiki/Chess'>Chess!</a></p>
21
+ <p>You can find the main repository at <a href='https://github.com/ucsc-cse-240/chessai'>github.com/ucsc-cse-240/chessai</a>.</p>
22
+ <p>Below you can find API references for various different version of chessai.</p>
23
+ </p>
24
+ </div>
25
+
26
+ <div class='docs'>
27
+ <span>Versions:</span>
28
+ <ul>
29
+ <!-- API-DOC-MARKER -->
30
+ </ul>
31
+ </div>
32
+ </div>
33
+ </body>
34
+ </html>
@@ -0,0 +1,77 @@
1
+ # Chessai Code of Conduct
2
+
3
+ *This document outlines the general principles that one should follow when participating in any event/space that Chessai manages.*
4
+
5
+ Our goal is to create a healthy and vibrant community of contributors to support our mission.
6
+ To that end, we have created a few guiding principles that we ask all participants to adhere to.
7
+ The principles enumerated here are are guidelines, not hard-and-fast rules, and may evolve over time.
8
+ Do your best to act in accordance with the spirit of these guidelines.
9
+
10
+ Serious or repeat offenders may be temporarily or permanently banned from Chessai resources.
11
+
12
+ ## Code of Conduct
13
+
14
+ ### You are Responsible for Your Contributions
15
+
16
+ You should be able to understand, explain, and justify every piece of code or resource that you contribute.
17
+ Of course, we do not expect all code to be impossibly bug-free,
18
+ but you should do your best to produce the highest quality code you can.
19
+
20
+ You are responsible for ensuring that you have the legal right to submit all code/resources you present.
21
+
22
+ ### Be Respectful
23
+
24
+ Try to act with respect, compassion, and empathy towards everyone in accordance with reason.
25
+ Insults or harassment are not acceptable.
26
+
27
+ ### Act in Good Faith and Assume Good Faith from Others
28
+
29
+ There are many differing ways to produce high-quality software,
30
+ assume that others are working towards that same goal as you
31
+ (even if they are approaching it from a different direction).
32
+
33
+ ### Foster Collaboration
34
+
35
+ Do your best to promote a collaborative environment.
36
+
37
+ Ask questions when you need to and do your best to answer the questions of others.
38
+ When asking questions, be mindful to respect the time of others.
39
+ Asking for help is an inevitable part of contributing,
40
+ but ensure that your have done your due-diligence before asking for help.
41
+
42
+ Prefer open communication methods (e.g., a forum post instead of a direct message)
43
+ so that others can learn from and join relevant discussions.
44
+
45
+ Try to keep discussions and disagreements constructive and focused on the task at hand.
46
+
47
+ ### Try to be Concise
48
+
49
+ More text often means more work and more opportunities for misunderstanding.
50
+ Try to be concise and direct with your communication, documentation, and code.
51
+ Take your time to choose words carefully rather than using many words that may be misconstrued.
52
+
53
+ ### Never Stop Learning
54
+
55
+ In addition to just collaborating,
56
+ do your best to maintain a safe learning environment for everyone.
57
+ We strive to always learn more and improve.
58
+
59
+ ### When Someone Breaks the Code
60
+
61
+ If you encounter someone who is not adhering to these guidelines,
62
+ try to politely point them to this code of conduct.
63
+ Remember that someone may just be having a hard time or trouble communicating.
64
+
65
+ If you have persisting problems, contact [lmellenb@ucsc.edu](mailto:lmellenb@ucsc.edu).
66
+
67
+ ## Resources / Inspirations
68
+
69
+ Below are some resources that we consulted and took inspiration from when writing our code of conduct:
70
+ - https://opensourceconduct.com
71
+ - https://www.ashedryden.com/blog/codes-of-conduct-101-faq
72
+ - https://confcodeofconduct.com/
73
+ - https://terms.archlinux.org/docs/code-of-conduct/
74
+ - https://www.apache.org/foundation/policies/conduct.html
75
+ - https://www.debian.org/code_of_conduct
76
+ - https://www.djangoproject.com/conduct/
77
+ - https://www.freebsd.org/internal/code-of-conduct/
@@ -0,0 +1,152 @@
1
+ # Chessai Contributing Guide
2
+
3
+ Thanks for wanting to contribute!
4
+
5
+ All code and resources contributed to a project become owned by the project under the respective license upon submission.
6
+
7
+ ## Code of Conduct
8
+
9
+ Make sure to familiarize yourself with our [Code of Conduct](./CODE_OF_CONDUCT.md).
10
+
11
+ ## Reporting Issues
12
+
13
+ To allow for flexibility when it comes to issue types and submission contexts,
14
+ we do not have a strict template for reporting issues.
15
+ Try to follow this general guidance when submitting (or dealing with) issues:
16
+
17
+ - Be sure to clearly state your issue.
18
+ Be descriptive and concise.
19
+ The required information changes depending on the specific needs,
20
+ but some information generally required for bugs is:
21
+ - Steps to reproduce the issue.
22
+ - Expected vs actual behavior.
23
+ - Your environment (OS, language version, etc.) if applicable.
24
+
25
+ - Note that issues are not meant for arbitrary communication,
26
+ see [the Discussion section](#discussion) for guidance on that.
27
+
28
+ - Remember that the aims of the project may differ from your personal needs.
29
+ So, a contributor may not agree with the priority or need for an issue.
30
+
31
+ - Remember that this is open source and we have limited resources,
32
+ so we may not address an issue as fast as you would like.
33
+ In cases like this, submitting a PR yourself could help out.
34
+
35
+ - We don't call "dibs" or reserve issues.
36
+ A PR is the best way to show others your interest in an issue.
37
+ Conversely, if you clearly see someone working on an issue, don't try to "scoop" them.
38
+ If it looks like an effort was abandoned, feel free to politely ask them or an admin if they are going forward with it.
39
+
40
+ ## Submitting a PR
41
+
42
+ Thanks for wanting to contribute to our projects!
43
+ Healthy open source ecosystems depend on contributors like you.
44
+ Pull/Merge requests (and code reviews) are a fundamental part of Software Engineering.
45
+ They can be very intimidating (especially to a new developer),
46
+ but they are the type of thing that gets easier the more you do them.
47
+
48
+ ### General Guidance on PRs
49
+
50
+ - Contributors should strive to make things as easy as possible on the reviewer.
51
+ You are using their time, so make sure to respect it.
52
+
53
+ - Ensure that the description is sufficient, but concise.
54
+ Overly long PR descriptions waste the reviewer's time.
55
+
56
+ - Keep in mind that PR comments are generally terse, but constructive.
57
+ Try to read them with a positive outlook.
58
+ Receiving criticism on code can be tough at first, it gets easier over time.
59
+
60
+ - You are responsible for ensuring that you have the legal right to submit all code/resources you present.
61
+
62
+ - When you are ready for a new pass/re-review, make sure to explicitly let the reviewer know you are ready.
63
+ Often the PR system (like GitHub) may send out messages for every commit, so it can be hard for a reviewer to tell when the code is ready.
64
+ There will usually be a "Re-request Review" button you can use to indicate that you are ready for another pass.
65
+
66
+ - Ensure that all comments are addressed before requesting another pass by a reviewer.
67
+ If a comment has been fully addressed, resolve it (via the resolve button) without further comments.
68
+ If a comment requires further discussion, then comment on it.
69
+ Keep in mind what things will look like for the reviewer.
70
+ When they re-review a PR, they should only see things that need action on their part.
71
+
72
+ - Note that this also applies when a reviewer asks a question in a comment,
73
+ and you agree with the premise of the question and make changes accordingly.
74
+ For example, if a review says: "Shouldn't this be 1?",
75
+ then you can just resolve if you agree that it should be 1 and you make that change.
76
+ Only comment if further discussion is required.
77
+
78
+ - Take your time.
79
+ Quality is strongly preferred over quantity.
80
+
81
+ - Do not submit an AI code review to your own PR (e.g., having CoPilot do a pass on a PR).
82
+ A reviewer may choose to use an AI tool to assist them with a review,
83
+ but a contributor should not submit reviews to their own code.
84
+
85
+ - Review your own PR before asking for a (re)review.
86
+
87
+ ### Extra Advice for New Contributors
88
+
89
+ For contributors that are new to PRs,
90
+ here is a general procedure you can follow:
91
+ 1. Fork the target repo.
92
+ 2. Make a branch in your fork for the new changes (here we will call it `change-branch`).
93
+ 3. Implement your code, tests, and documentation in `change-branch`. Make sure your code passes testing and CI.
94
+ 4. Review your code.
95
+ 5. Create a new branch for your PR based on `change-branch` (here we will call it `pr-branch`).
96
+ 6. Create a PR using `pr-branch`.
97
+ 7. Wait patiently for comments.
98
+ 8. Address comments first in `change-branch`.
99
+ 9. Do a self review. Make sure to check style, tests, and CI.
100
+ 10. Once your changes are looking good, merge them into `pr-branch`.
101
+ 11. Re-request a review (there is usually a button for this).
102
+ 12. If changes are requested, GOTO 7.
103
+ 13. Done! Update your fork.
104
+
105
+ Note that the use of multiple branches is to avoid excess emails that can happen when you push changes to a branch with an open PR.
106
+ It also gives more advanced users the opportunity to squash changes before the next PR pass.
107
+
108
+ For new contributors, we have some additional rules:
109
+ - At most 1 open PR at a time.
110
+ - Try to stick to "Easy" issues.
111
+ It is expected that contributors tackling "Medium/Hard" issues are experienced with this repository and/or open source development.
112
+ We will provide limited or no support for new contributor tackling harder issues.
113
+
114
+ ## General Coding Style
115
+
116
+ The coding style we use will differ based on the language and project.
117
+ Follow the rules of the specific project/repo you are in.
118
+
119
+ In general, follow these principles:
120
+
121
+ - Be consistent with existing code.
122
+ - Strive to write maintainable code that is:
123
+ - easy to read,
124
+ - self documenting,
125
+ - and not surprising.
126
+
127
+ ## AI Tools
128
+
129
+ We do not outright ban the use of AI coding tools.
130
+ However, it is important to remember that all code you submit is considered yours.
131
+ You are responsible for all your code.
132
+ You are expected to fully understand, explain, and justify all your code.
133
+ If we find that you are not acting responsibly with your code, we may ban you.
134
+
135
+ AI tools can make it very easy to do things like submit PRs,
136
+ but can waste a reviewer's time if the code is of low-quality.
137
+ Not respecting a review's time is against our [Code of Conduct](./CODE_OF_CONDUCT.md#foster-collaboration) and can result in being banned.
138
+
139
+ If you are using a coding tool and someone asks you about it,
140
+ you should be honest and willing to disclose the tool, version, and how you used it.
141
+ If you are not comfortable disclosing this information, then avoid using AI coding tools.
142
+
143
+ Also be wary when using AI tools for text/conversations (e.g., emails, PR descriptions, issues, etc).
144
+ AI will often generate text that is much longer and more verbose than necessary.
145
+ Unnecessarily long conversations are generally against our [Code of Conduct](./CODE_OF_CONDUCT.md#try-to-be-concise).
146
+
147
+ We always encourage learning.
148
+ If you use AI tools, use them in a way that helps you learn, instead of taking away your learning opportunities.
149
+
150
+ ## Discussion
151
+
152
+ For discussion outside of GitHub, you can use our [Discord](https://discord.gg/xRxdbWqtWS).
@@ -0,0 +1,152 @@
1
+ name: Main
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ test:
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ python-version: ['3.11', '3.12', '3.13', '3.14']
13
+ os: ['ubuntu-22.04', 'ubuntu-24.04', 'macos-14', 'macos-15', 'windows-2022', 'windows-2025']
14
+
15
+ runs-on: ${{ matrix.os }}
16
+
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Set up Python ${{ matrix.python-version }}
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ - name: Cache Python Dependencies
27
+ uses: actions/cache@v4
28
+ with:
29
+ path: ${{ env.pythonLocation }}
30
+ key: ${{ runner.os }}-os:${{ matrix.os }}-python:${{ matrix.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
31
+
32
+ - name: Install Dependencies
33
+ shell: bash
34
+ run: pip install -r requirements.txt -r requirements-dev.txt
35
+
36
+ - name: Check Python Version Compatibility
37
+ shell: bash
38
+ run: scripts/check_python_version.sh
39
+
40
+ - name: Check Types
41
+ shell: bash
42
+ run: ./scripts/check_types.sh
43
+
44
+ - name: Check Lint
45
+ shell: bash
46
+ run: ./scripts/check_lint.sh
47
+
48
+ - name: Run Tests
49
+ shell: bash
50
+ run: ./scripts/run_tests.sh
51
+
52
+ - name: Generate Documentation
53
+ if: runner.os == 'Linux'
54
+ shell: bash
55
+ run: ./scripts/gen_docs.sh
56
+
57
+ docs:
58
+ needs: test
59
+ if: ${{ github.event_name == 'push' && github.repository_owner == 'ucsc-cse-240' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
60
+
61
+ permissions:
62
+ contents: read
63
+ pages: write
64
+ id-token: write
65
+
66
+ environment:
67
+ name: github-pages
68
+ url: ${{ steps.deployment.outputs.page_url }}
69
+
70
+ strategy:
71
+ matrix:
72
+ python-version: ['3.11']
73
+ os: ['ubuntu-24.04']
74
+
75
+ runs-on: ${{ matrix.os }}
76
+
77
+ steps:
78
+ - name: Checkout
79
+ uses: actions/checkout@v4
80
+ with:
81
+ fetch-depth: 0
82
+ fetch-tags: true
83
+
84
+ - name: Set up Python ${{ matrix.python-version }}
85
+ uses: actions/setup-python@v5
86
+ with:
87
+ python-version: ${{ matrix.python-version }}
88
+
89
+ - name: Cache Python Dependencies
90
+ uses: actions/cache@v4
91
+ with:
92
+ path: ${{ env.pythonLocation }}
93
+ key: ${{ runner.os }}-os:${{ matrix.os }}-python:${{ matrix.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
94
+
95
+ - name: Install Dependencies
96
+ shell: bash
97
+ run: pip install -r requirements.txt -r requirements-dev.txt
98
+
99
+ - name: Setup Pages
100
+ uses: actions/configure-pages@v5
101
+
102
+ - name: Build Site
103
+ shell: bash
104
+ run: |
105
+ git checkout main
106
+ ./.ci/build_site.sh
107
+
108
+ - name: Upload Artifact
109
+ uses: actions/upload-pages-artifact@v3
110
+ with:
111
+ path: '._site'
112
+
113
+ - name: Deploy to GitHub Pages
114
+ id: deployment
115
+ uses: actions/deploy-pages@v4
116
+
117
+ deploy:
118
+ needs: docs
119
+
120
+ strategy:
121
+ matrix:
122
+ python-version: ['3.11']
123
+ os: ['ubuntu-24.04']
124
+
125
+ runs-on: ${{ matrix.os }}
126
+
127
+ steps:
128
+ - name: Checkout
129
+ uses: actions/checkout@v4
130
+
131
+ - name: Set Up Python ${{ matrix.python-version }}
132
+ uses: actions/setup-python@v5
133
+ with:
134
+ python-version: ${{ matrix.python-version }}
135
+
136
+ - name: Cache Python Dependencies
137
+ uses: actions/cache@v4
138
+ with:
139
+ path: ${{ env.pythonLocation }}
140
+ key: ${{ runner.os }}-os:${{ matrix.os }}-python:${{ matrix.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
141
+
142
+ - name: Install Python Dependencies
143
+ shell: bash
144
+ run: pip3 install -r requirements.txt -r requirements-dev.txt
145
+
146
+ - name: Deploy
147
+ uses: casperdcl/deploy-pypi@10cf4cd83fc885003a8d4f37f93a5a0f0fc2d2f4 # v2.4.1
148
+ with:
149
+ build: --sdist --wheel --outdir dist . --verbose
150
+ # Only upload if a tag is pushed (otherwise just build & check).
151
+ upload: ${{ github.event_name == 'push' && github.repository_owner == 'ucsc-cse-240' && startsWith(github.event.ref, 'refs/tags') }}
152
+ password: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,34 @@
1
+ # Editor Files
2
+ .DS_Store
3
+ *.swp
4
+
5
+ # Language Dirents
6
+ .ipynb_checkpoints
7
+ node_modules/
8
+ venv/
9
+ *.pyc
10
+ __pycache__/
11
+
12
+ # Common Temp Dirents
13
+ old/
14
+ temp/
15
+ out*/
16
+ /test*
17
+
18
+ # Build
19
+ /bin/
20
+ /build/
21
+ /dist/
22
+ *.egg-info
23
+ /html/
24
+ /.mypy_*/
25
+
26
+ # Project-Specific
27
+ *.gif
28
+ *.gz
29
+ /._site/
30
+ *.zip
31
+ *.xcf
32
+
33
+ # Do track .gz files in the resources/games directory.
34
+ !chessai/resources/games/*.gz
@@ -0,0 +1,9 @@
1
+ [mypy]
2
+
3
+ exclude = _test\.py$
4
+
5
+ strict = false
6
+ disable_error_code = type-arg
7
+
8
+ [mypy-edq.*]
9
+ ignore_missing_imports = True