项目作者: rlichiere

项目描述 :
Python/Django online chess game
高级语言: Python
项目地址: git://github.com/rlichiere/django-chess.git
创建时间: 2017-08-20T14:56:11Z
项目社区:https://github.com/rlichiere/django-chess

开源协议:

下载


django-chess

Release Note

0.0.1

[ui] basic stuff

  • grid
  • pieces

0.0.2

[game logic]

  • implementation of all pieces standard moves
  • added special moves : Pawn+2, Enpassant, Promotion

[ui]

  • colors on selected/moved pieces
  • logs
  • turn side information
  • debug details

0.0.3

[game logic]

  • avoid move inducing check on own king
  • added checkmate/surrender button (required to finish a game when checkmate)
  • added complete rook move
  • user management
    • authentication form and views filtering
    • user participation management
    • winning_games management
  • color_set customization

[ui]

  • lifter in logs panel
  • own king check information
  • lobby : opened, running and closed games, game creation
  • filter menu buttons depending on user profile :
    • viewer : nothing
    • player : surrender/checkmate
    • game creator : Reset current round, Reset game
  • refresh page for waiting player and viewers

0.0.4

[game logic]

  • user registration :
    • players are able to registrate
    • players are able to change their password

[ui]

  • registration form
  • improvements in lobby, game and profile pages
  • show kingcheck

0.0.5

[game logic]

[ui]

  • game page shows players material
  • history of ranked games
  • added filter games history : ranked/unranked/all
  • user theme management
  • major improvements everywhere :
    • layouts
    • forms
    • cleaned colors

0.0.6

[feature_kimdeploy]

  • changed settings.py with MIDDLEWARE_CLASSES
  • added requirements.txt
  • added migrations
  • added create_superuser management command
  • added mysql database connection
  • added DB_PORT management
  • added Dockerfile

[game logic]

  • corrected a bug when a new player views a game before going to his profile

[ui]

Incoming

feature_custom_piece_set

[game_logic]

  • user custom pieces management
  • yamled available_themes, available_pieces and levels

[ui]

  • profile : added piece selector
  • profile : filter theme and piece set depending on player level
  • nav : added Admin link
  • added Documentation

Todo

Urgent

[game logic]

  • load game (except for ranked games)
    • give possibility to change player sides
  • opened games list : add ranked/unranked option

[ui]

  • add elo level icons
  • show players elo level in ranked games

ShortTerm

[game logic]

  • give user capacity to :
    1. edit/delete its own games
    2. start the game when all sides have a player

[ui]

  • information for all avoid move cases
  • link a graphical set to each level (activable by user in its profile)

MidTerm

[game logic]

  • for viewers : add capacity to move in history and log

LongTerm

[game logic]

  • refactor lobby mechanics to a Lobby class :
    • game management : generic status to retrieve opened/running/finished/archived specific status
    • game creation : generic form to manage game specific creation process)
    • user management : generic user participation (1v1, NvN, etc)
  • user ranking :
    • Elo calculation
    • player Elo initialization
    • find ranked game (based on Elo)
    • find unranked game (based on Elo, or not)

[ui]

  • bootstrap
  • nice colors (button)
  • Elo statistic pages

Refactoring

Shield :

  • x,y/c,l coordinates

Layerize :

  • think about a kind of BoardDataAccessor to facilite/centralize access to board data :

    • standard format to pass request parameters (by-coords/by-piece, etc)
  • think about a real game_data object to improve access to sql data :

    • get : return cache data, otherwise sql data (and store in cache)
    • set : stores data in sql and cache

PersistentData Game Model :

  1. {
  2. 'token': {
  3. 'step': {
  4. 'side': '[white/black]'
  5. 'name': '[waitReadyToStart/waitCellSource/waitCellTarget/pieceMoved/checkmate]'
  6. 'data': {
  7. 'targetCell": {
  8. 'column': 'f',
  9. 'line": '4'
  10. },
  11. 'sourceCell': {
  12. 'column': 'f',
  13. 'line': '2'
  14. },
  15. ['eaten': {
  16. 's': 'w',
  17. 'r': 'P',
  18. 'n': 'p6'
  19. }]
  20. }
  21. ['enpassant': {
  22. 'y': 3,
  23. 'x': 5
  24. }]
  25. },
  26. 'logs': {
  27. '001.': {
  28. 'official': 'e2-e4',
  29. 'side': 'w',
  30. 'source': {
  31. 'x': 'e',
  32. 'y': '2',
  33. 'piece': {
  34. 's': 'w',
  35. 'r': 'P',
  36. 'n': 'P5'
  37. }
  38. },
  39. 'target': {
  40. 'x': 'e',
  41. 'y': '4',
  42. 'piece': '-'
  43. },
  44. 'board': {
  45. [board_data],
  46. },
  47. },
  48. [...]
  49. }
  50. },
  51. 'board': {
  52. '1': {
  53. 'a': {
  54. 's': 'w',
  55. 'r': 'R',
  56. 'n': 'r2'
  57. },
  58. [...]
  59. },
  60. [...]
  61. },
  62. 'logs': {
  63. 'nnn': {
  64. 'side': 'white/black',
  65. 'official': 'xxx/e2-e4',
  66. 'source': {
  67. 'piece': 'p',
  68. 'x': 'e',
  69. 'y': '2'
  70. },
  71. 'target': {
  72. 'x': 'e',
  73. 'y': '4'
  74. }
  75. }
  76. },
  77. 'game_options': {
  78. 'name': 'xxx',
  79. 'winning_games': 1/2/n,
  80. 'creator': user_id,
  81. 'ranked': true/false,
  82. 'public': true/false,
  83. 'logging': true/false,
  84. },
  85. 'participants': {
  86. 'white': {
  87. '1': user_id,
  88. },
  89. 'black': {
  90. '1': user_id,
  91. '2': user_id,
  92. }
  93. },
  94. 'rounds': {
  95. '1': {
  96. 'result': 'checkmate/draw/withdraw',
  97. 'winner': 'white/black'
  98. }
  99. },
  100. 'result': {
  101. 'winner': 'white/black',
  102. 'round_list': 'wbw',
  103. }
  104. }

Limitations

  • no check/checkmate arbitration (checkmate must be manually played to be applied)

known bugs

GRAVE (not contournable)

  • crash on checkmate when no player in other side
  • crash on profile when player has no history (= no game result in its rankings)

MAJOR (contournable manually)

  • Enabled logging overloads game_data
    • should test performance with mysql
    • should test performance with real webserver
    • should remove boards and logs from render2jsondebug

MINOR

  • promotion available when checkmate todo : a verifier

fast ideas

token change automations

  • king checking :
    • checkmate should be automatically detected

gamelogic

  • ending of game (withdraw, draw)