{"id":15581018,"url":"https://github.com/eduardo06sp/chess-cli","last_synced_at":"2025-03-29T08:22:31.978Z","repository":{"id":107478601,"uuid":"395545610","full_name":"Eduardo06sp/chess-cli","owner":"Eduardo06sp","description":"A 2-player game of Chess built using a git feature branch workflow.","archived":false,"fork":false,"pushed_at":"2021-11-23T06:41:17.000Z","size":824,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-03T22:38:48.903Z","etag":null,"topics":["chess","chess-game","oop","ruby","terminal-game"],"latest_commit_sha":null,"homepage":"https://replit.com/@Eduardo06sp/Chess-CLI?v=1","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Eduardo06sp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-13T06:39:23.000Z","updated_at":"2022-07-24T19:55:33.000Z","dependencies_parsed_at":"2023-05-17T14:00:34.946Z","dependency_job_id":null,"html_url":"https://github.com/Eduardo06sp/chess-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eduardo06sp%2Fchess-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eduardo06sp%2Fchess-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eduardo06sp%2Fchess-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eduardo06sp%2Fchess-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eduardo06sp","download_url":"https://codeload.github.com/Eduardo06sp/chess-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246157620,"owners_count":20732646,"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-game","oop","ruby","terminal-game"],"created_at":"2024-10-02T19:41:04.009Z","updated_at":"2025-03-29T08:22:31.965Z","avatar_url":"https://github.com/Eduardo06sp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chess (CLI)\n![A screenshot showing the start of a new game](media/new_game_screenshot.png \"New Chess Game\")\n\u003e **Note:** If running the app locally, it is highly recommended that you increase your font size (this must be set by the user). If running the live version, it is not possible to increase font size at the time of writing.\n\nA 2-player version of Chess played in the terminal and integrating special rules (e.g. en passant and castling).\n\n[Click here to play a live version on Replit (click the big play button and wait for the script to execute).](https://replit.com/@Eduardo06sp/Chess-CLI?v=1)\n\n## Table of Contents\n* [General Information](#general-information)\n* [Installing / Getting Started](#installing--getting-started)\n* [Features](#features)\n* [Usage](#usage)\n  * [Special Rules](#special-rules)\n  * [Saving / Loading](#savingloading)\n  * [Running Tests](#running-rspec-tests)\n* [Acknowledgements](#acknowledgements)\n* [Reporting Issues / Feedback / Contact](#reporting-issuesfeedbackcontact)\n\n## General Information\nChess is a 2-player game in which two players take turns moving pieces. Each piece may move in a unique manner, and the objective is to place the opponent's King into checkmate (i.e. trap them in a spot so they have nowhere to move).\n\nThis project was a significant undertaking as there are so many different components to the game. The goal was to keep methods and classes as modular as I could and take into account various edge-cases. Testing with RSpec was of vital importance, and minimizing bloated code was key to hunting down errors in the game.\n\nAnother significant challenge was using a git feature branch workflow. Creating branches when trying new features out helped me learn a lot about rebasing and merging branches. There were a lot of unique errors encountered in git, which helped me explore git features such as amending commits and solving merge conflicts with my built-in text editor (VIM).\n\nTo learn more about playing Chess, [click here for a guide.](https://www.chess.com/learn-how-to-play-chess)\n\n## Installing / Getting Started\n\u003e Prerequisites:\n\u003e\n\u003e * Ruby \u003e= 2.7.2 (may work on older versions)\n\n```console\ngit clone https://github.com/Eduardo06sp/chess-cli.git\ncd chess-cli/\nruby lib/main.rb\n```\n\nYou will then be prompted to set up the game and the game will start.\nInput game board locations to make piece selections / moves (e.g. `a4`).\n\n## Features\nCore Features:\n* Capturing\n* Checking\n  * Prevent any move/capture from putting own King into check\n* Save / load\n  * Limit: 5 slots\n\nGame-ending Rules:\n* Checkmate\n* Insufficient material\n  * King \u0026 Bishop vs. King\n  * King \u0026 Knight vs. King\n* Stalemate\n* Resignation\n\nSpecial Rules:\n* Pawn hop/double-move\n* Castling\n  * King and Queen side\n* En passant\n* Promotion\n\nCertain official rules of Chess have not been implemented.\nThey are as follows:\n* Timer\n* User-initiated draws\n  * Mutual agreement\n  * 3-fold repetition\n  * 50-move rule\n* Automatic draws\n  * 5-fold repitition\n  * 75-move rule\n\n## Usage\nChess is a complex game with a special set of rules.\n[Here is an excellent guide to learn more about how to play Chess.](https://www.chess.com/learn-how-to-play-chess) Please note that the article mentions user-initiated draws (draw by agreement, 3-fold repitition \u0026 50-move rule), features which are not implemented in this version of Chess.\n\n### Starting a new game\nEnsure you are inside the `chess-cli` folder.\nThen run `main.rb`.\n```console\nruby lib/main.rb\n```\n\nType `new` to start a new game.\nEnter a name for player one, or simply press enter (without any input) to use the default (Player 1).\nEnter a color (`black` or `white`) or just press enter to use \"white\".\nEnter a name for player two, or press enter to use the default (Player 2).\n\n### Selecting \u0026 moving pieces\nRanks (rows 1-8) and files (columns A-H) are used to specify locations on the board.\nTo move a2 Pawn to a3, select the a2 Pawn upon being prompted:\n```console\na2\n```\n\nThen, you will be asked to make a move:\n```console\na3\n```\n\nThen it is the other player's turn. You will continue until someone wins or a draw occurs.\n\n### Special Rules\nIn Chess, there are various special rules such as:\n* Pawn hop/double-move\n* Castling\n* En passant\n* Promotion\n\nFor more information (and a simple explanation) of the special rules, refer to [the previously linked guide to Chess](https://www.chess.com/learn-how-to-play-chess#special-rules-chess).\n\n#### Pawn hop/double-move\nTo Pawn hop (conditions permitting), simply type in the space located two spots away from the selected Pawn.\n\nE.g. Pawn hopping from a2 to a4:\n```console\na2\na4\n```\n\n#### Castling\nTo castle (conditions permitting), you may either:\n1. Move the Rook to the space adjacent to the King\n2. Move the King two spaces towards the Rook\n\nThe game will automatically move the Rook/King to their appropriate places.\n\n#### En passant\nTo en passant (conditions permitting), simply type in the empty space the enemy Pawn hopped over.\n\nThe game will automatically capture/remove the enemy Pawn.\n\n#### Promotion\nTo promote a Pawn, you will be prompted to upgrade your Pawn once you reach the final rank.\nYou may input any of the following, and your Pawn will be replaced with the selected piece type:\n* Rook\n* Knight\n* Bishop\n* Queen\n\nThe game will replace the promoted Pawn with your selection.\n\n### Saving/loading\n#### Saving\nTo save the current state of the board, it must take place at the initial round prompt.\nThere is a message indicating that you may save the game.\nTo save:\n```console\nsave\n```\n\nYou will be prompted to enter a name or overwrite an existing save.\nEnter a name.\nYou will get a confirmation once it successfully saves the game.\n\nYou may continue to play afterwards.\n\n#### Loading\nYou may load a game when first launching the game.\nIn the initial game prompt, type:\n```console\nload\n```\n\nYou will be prompted to select a slot number (1-5).\nTo select the first save, simply type:\n```console\n1\n```\n\n#### Overwriting\nYou will have to overwrite your saves if you try to exceed 5 saves, or if you choose this option when saving.\nTo overwrite, after selecting it or exceeding 5 saves, you will be prompted to select the save file number that will be overwritten.\nTo overwite the first save, type:\n```console\n1\n```\n\nThen you will be prompted to enter a name.\nEnter a name.\nYou will see a message once the game succesfully saves.\n\nYou may continue to play.\n\n### Resigning / Exiting\n\u003e If you are stuck for any reason, press `Ctrl + C` (depending on your system) to force close the app. See [Reporting Issues/Feedback](#reporting-issuesfeedbackcontact) to report it.\n\nYou may resign/exit in-game by typing any of the following during the inital round prompt:\n```console\nresign\nexit\nquit\n```\n\n### Running RSpec tests\n\u003e Prerequisites:\n\u003e\n\u003e * Ruby \u003e= 2.7.2 (may work on older versions)\n\u003e * RSpec \u003e= 3.10 (may work on older versions)\n\nFrom within `chess-cli` folder, run:\n```console\nrspec spec/game_board_spec.rb\nrspec spec/chess_spec.rb\n```\n\n## Acknowledgements\n* [The Odin Project](https://www.theodinproject.com/home), my favorite, highly-recommended resource for learning full-stack web development\n  * For providing this project idea ([see the instructions for this assignment here](https://www.theodinproject.com/paths/full-stack-ruby-on-rails/courses/ruby-programming/lessons/ruby-final-project))\n  * For their kind, helpful Discord community\n* [TextKool](https://textkool.com/en), an ASCII text-art generator (plus more!)\n  * Used to display draw \u0026 checkmate text art\n\n## Reporting Issues/Feedback/Contact\nBug reports are greatly appreciated. You may create a new issue with a description of the problem, and the steps leading up to it.\n\nPRs are kindly appreciated. The project tries to adhere to Rubocop's default coding guidelines, but this is only a soft requirement.\n\nYou may also contact me at: eduardopelaez@pm.me\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feduardo06sp%2Fchess-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feduardo06sp%2Fchess-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feduardo06sp%2Fchess-cli/lists"}