{"id":20530029,"url":"https://github.com/replomancer/swordfight","last_synced_at":"2025-04-14T05:21:15.160Z","repository":{"id":26000606,"uuid":"29443088","full_name":"replomancer/Swordfight","owner":"replomancer","description":"A chess engine written in Clojure","archived":false,"fork":false,"pushed_at":"2018-02-28T20:06:08.000Z","size":396,"stargazers_count":11,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T19:10:00.774Z","etag":null,"topics":["chess","chess-engine","clojure","xboard"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/replomancer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-18T22:11:31.000Z","updated_at":"2024-05-25T15:13:13.000Z","dependencies_parsed_at":"2022-09-04T09:10:17.655Z","dependency_job_id":null,"html_url":"https://github.com/replomancer/Swordfight","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replomancer%2FSwordfight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replomancer%2FSwordfight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replomancer%2FSwordfight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/replomancer%2FSwordfight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/replomancer","download_url":"https://codeload.github.com/replomancer/Swordfight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248824996,"owners_count":21167413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chess","chess-engine","clojure","xboard"],"created_at":"2024-11-15T23:35:06.765Z","updated_at":"2025-04-14T05:21:15.130Z","avatar_url":"https://github.com/replomancer.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/replomancer/Swordfight.svg?branch=master)](https://travis-ci.org/replomancer/Swordfight)\n\n# Swordfight\n\n\n\"*A game of chess is like a sword fight. You must think first before you move.*\"\n([Shaolin and Wu Tang](https://en.wikipedia.org/wiki/Shaolin_and_Wu_Tang))\n\nSwordfight is a chess engine (no GUI, just a chess AI). It's CECP-compatible and\nworks with XBoard GUI.\n\n\n## Usage\n\n1. Download [the latest release jar file](https://github.com/replomancer/Swordfight/releases).\n2. Install [XBoard](https://www.gnu.org/software/xboard/) (should be available\n   in your favorite package manager).\n3. Run `xboard` and choose `Engine -\u003e Load New 1st Engine`.\n   To add Swordfight as a new engine you need to set \"Engine Directory\" to\n   to the directory containing the jar file and type `java -jar \u003cjar_filename\u003e`\n   in \"Engine Command\". This will make Swordfight play as black.\n4. Play.\n\nAlternatively if you want to run the latest version from the repository:\n1. Download this repo.\n2. Install [Leiningen](http://leiningen.org/) (requires Java JDK version 6 or\n   later).\n3. Install [XBoard](https://www.gnu.org/software/xboard/).\n4. Run `xboard` and choose `Engine -\u003e Load New 1st Engine`.\n   To add Swordfight as a new engine you need to point to the repo directory\n   and set `lein run` as command. This will make Swordfight play as black.\n5. Play.\n\nSwordfight currently uses parallelized alpha-beta pruning (YBWC) with Tomasz Michniewski's [simplified evaluation function](http://chessprogramming.wikispaces.com/Simplified+evaluation+function). If you run `xboard -debug` there will be some debugging info in the `xboard.debug` file.\n\n![XBoard window](https://raw.githubusercontent.com/replomancer/Swordfight/master/doc/mexican_defense.png)\n\n\nYou can also play without a GUI by running `lein run` and using a command line interface\nlike in the session below (user input is after the `\u003e` prompt). A monospaced font in your\nterminal is highly recommended for the debug output (chess board):\n\n```\n# {:xboard-mode false, :debug-mode true, :edition-current-color W}\n# {:white-can-castle-ks true, :black-can-castle-qs true, :last-move [     ], :edited false, :turn W, :black-can-castle-ks true, :moves-cnt 0, :white-can-castle-qs true}\n#\n# 8  ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜\n# 7  ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟\n# 6                 \n# 5                 \n# 4                 \n# 3                 \n# 2  ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙\n# 1  ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖\n#\n#    a b c d e f g h\n#\n\u003e e2e4\n# {:white-can-castle-ks true, :black-can-castle-qs true, :last-move [e2 e4], :edited false, :turn B, :black-can-castle-ks true, :moves-cnt 1, :white-can-castle-qs true}\n#\n# 8  ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜\n# 7  ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟\n# 6                 \n# 5                 \n# 4          ♙      \n# 3                 \n# 2  ♙ ♙ ♙ ♙   ♙ ♙ ♙\n# 1  ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖\n#\n#    a b c d e f g h\n#\nmove b8c6\n# {:xboard-mode false, :debug-mode true, :edition-current-color W}\n# {:white-can-castle-ks true, :black-can-castle-qs true, :last-move [b8 c6], :edited false, :turn W, :black-can-castle-ks true, :moves-cnt 2, :white-can-castle-qs true}\n#\n# 8  ♜   ♝ ♛ ♚ ♝ ♞ ♜\n# 7  ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟\n# 6      ♞          \n# 5                 \n# 4          ♙      \n# 3                 \n# 2  ♙ ♙ ♙ ♙   ♙ ♙ ♙\n# 1  ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖\n#\n#    a b c d e f g h\n#\n\u003e\n```\n\nI think the unicode chess pieces look pretty neat!\n\n♜ ♖ ♞ ♘ ♝ ♗ ♛ ♕ ♚ ♔ ♟ ♙\n\nDepending on the terminal the colors may be confusing. ♜ is black.\n\n## Protocol\n\nThis engine will slowly become more and more\n[CECP](https://en.wikipedia.org/wiki/Chess_Engine_Communication_Protocol)-compatible.\nBasically what it means is it reads from standard input and writes to standard output\nfollowing a commonly used protocol, which is based on GNU Chess CLI and designed by\nTim Mann, the author of XBoard. It's quite possible that Swordfight will support\nUniversal Chess Interface or other protocols in the future.\n\nHere's what [the author himself says about CECP](http://www.open-aurec.com/wbforum/WinBoard/engine-intf.html#4):\n\u003e Originally, xboard was just trying to talk to the existing command-line interface of GNU Chess 3.1+ and 4, which was designed for people to type commands to. So the communication protocol is very ad-hoc. It might have been good to redesign it early on, but because xboard and GNU Chess are separate programs, I didn't want to force people to upgrade them together to versions that matched. I particularly wanted to keep new versions of xboard working with old versions of GNU Chess, to make it easier to compare the play of old and new gnuchess versions. I didn't foresee the need for a clean protocol to be used with other chess engines in the future.\n\n## Did you know?\n\nThe field of computer chess started with\n[*Programming a Computer for Playing Chess*](http://archive.computerhistory.org/projects/chess/related_materials/text/2-0%20and%202-1.Programming_a_computer_for_playing_chess.shannon/2-0%20and%202-1.Programming_a_computer_for_playing_chess.shannon.062303002.pdf),\na 1950 paper by [Claude Shannon](http://en.wikipedia.org/wiki/Claude_Shannon). Why is it that old papers are better than new ones? I don't know.\n\nDid you know that the number of possible positions in chess is bigger than the number of atoms in the observable universe? That's a lot of positions!\n\n## License\n\nDistributed under the 2-clause BSD license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freplomancer%2Fswordfight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freplomancer%2Fswordfight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freplomancer%2Fswordfight/lists"}