{"id":19935081,"url":"https://github.com/nickersoft/connect-n","last_synced_at":"2026-05-10T13:53:21.945Z","repository":{"id":138468059,"uuid":"49894461","full_name":"Nickersoft/Connect-N","owner":"Nickersoft","description":"A small AI program written in C++ (with some Java) for playing Connect-N in the console.","archived":false,"fork":false,"pushed_at":"2023-12-15T08:33:02.000Z","size":252,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T02:11:18.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/Nickersoft.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":"2016-01-18T17:56:41.000Z","updated_at":"2023-06-03T17:26:02.000Z","dependencies_parsed_at":"2023-12-15T09:43:52.928Z","dependency_job_id":null,"html_url":"https://github.com/Nickersoft/Connect-N","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/Nickersoft%2FConnect-N","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nickersoft%2FConnect-N/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nickersoft%2FConnect-N/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nickersoft%2FConnect-N/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nickersoft","download_url":"https://codeload.github.com/Nickersoft/Connect-N/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241361446,"owners_count":19950381,"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":[],"created_at":"2024-11-12T23:18:43.273Z","updated_at":"2026-05-10T13:53:16.876Z","avatar_url":"https://github.com/Nickersoft.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Connect-N\n=========\n\nConnect-N is a terminal-based game similar to Connect 4, with the exception of there being a variable number of checkers that can be matched in a row instead of just four.\n\nThe game uses a Java-based referee to interact with the game, which can play against other users or against itself. It uses the Minimax algorithm with alpha-beta pruning to figure out the best moves to play against its opponent.\n\nPrerequisites\n-------------\n\n- [g++ Compiler](https://www.gnu.org/software/gcc/releases.html)\n- [Java](https://www.java.com/en/download/) and the [Java SE Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/index.html)\n- [GNU Make](https://www.gnu.org/software/make/)\n\nWhy C++ AND Java?\n-----------------\n\nThis program was originally meant to be written in Java, however, an individual who originally collaborated with me on the project was more fluent in C, so C++ was chosen as a happy medium. That collaborator left the project shortly thereafter, now leaving us with this strange hybrid of C++ and Java code.\n\nSetup For Windows\n-----------------\n\nSpecial instructions are required in order to run Connect-N on Windows. If you are using Linux or OS X, the prerequisites listed above can be installed using a package manager (`apt-get` on Linux or [Homebrew](http://brew.sh/)/[MacPorts](https://www.macports.org/) on OS X).\n\nHowever, if you do have Windows, you'll need [Cygwin](https://cygwin.com/install.html) to compile and run the game. Once you have downloaded the Cygwin installer package, run it and begin following the setup wizard. Eventually, you will be presented with a list of packages to install.\n\nExpand \"Devel\". Find and check the following three packages.\n\n1. gcc-core: GNU Compiler Collection (C, OpenMP) (v. 5.3.0-1)\n2. gcc-g++: GNU Compiler Collection (C++) (v. 5.3.0-1)\n3. make: The GNU version of the 'make utility' (v. 4.1-1)\n\nClicking \"Skip\" will cycle through the installation options. If the package isn't currently installed, the only other options will be version numbers to install. If the package is installed, \"Keep\" and \"Uninstall\" will be among the other options. If a version number is displayed, it means that the package is marked for installation.\n\n**Important:** although the version numbers do not necessarily matter for this program (you should still try to shoot for the most recent versions), gcc-core and gcc-g++ *must* have the same version number, otherwise you will run into issues while compiling. As of January 25, 2016, the most recent version of gcc-core and gcc-g++ is 5.3.0-1.\n\nOnce Cygwin is installed, open up the Cygwin terminal. Run the following command:\n\n\texport PATH=$PATH:'\u003cPATH-TO-JDK\u003e'\n\nwhere PATH-TO-JDK is the directory of your JDK `bin` directory. This command allows Cygwin to access `javac`, which is required to compile the referee.\n\n*Note*: This is usually located at C:\\Program Files\\Java\\jdk.x.x.x_xx\\bin on most default installations, the x's representing version and build numbers.\n\nNow you can continue to compile and run the program as outlined below.  \n\nRunning the Game\n----------------\n\n### The Easy Way\n\nIt is extremely simple to use the game. If you wish to run the game against itself, simply `cd` into the source directory and run:\n\n\tmake play_computer\n\nIf you wish to play the game yourself, just run:\n\n\tmake play_user\n\nKeep in mind that while playing the game on your own, you must input your moves in the following format:\n\n\t\u003ccolumn\u003e \u003coperation\u003e\n\nwhere the columns are zero-based (i.e. the first column is 0, the second is 1, etc.) and the operations that can be performed are either 1 (drop), which drops a checker in the column from the top, or 0 (pop out), which pops a checker out from the bottom of the given column. Please note that you can only play 1 pop out move per game.\n\n### The (Not So) Hard Way\n\nIf you wish to customize the game, you can run the original commands yourself:\n\n\tmake\n\tjava referee.Referee_User \"./Connect-N\" \"./Connect-N\" 6 7 3 10 10\n\nwhere the last five arguments are as follows:\n\n1. Height of the board\n2. Width of the board\n3. Number of checkers to match in a row ('N')\n3. Time limit for players to announce their names\n4. Time limit for players to make a move\n\nThe above command is for playing against the computer by yourself. If you wish to have the computer play itself, simply replace `Referee_User` with `Referee_Computer`.\n\nTo use the original, untampered version of the referee (which plays the computer against itself), run:\n\n\tmake\n\tjava -jar ./referee/Referee.jar \"./Connect-N\" \"./Connect-N\" 6 7 3 10 10\n\nEmpirical Valuation\n-------------------\n\nAn empirical valuation was performed on this game in order to test the significance of the heuristic function. For more info, click [here](EXPERIMENT.md).\n\nDebugging\n---------\n\nThe source directory comes with a nifty Tools class, which can be used for debugging purposes. Two noticeable functions are `log()` and `error()`, which write to `debug.log` and `error.log`, respectively. Both functions can also take in an extra integer parameter (in addition to a string), which will format the string using the integer provided (like printf).\n\nKnown limitations\n-----------------\n\nDue to time constraints, this implementation of Connect-N is not perfect. Connect-N does not go out of its way to avoid timeouts. Implementing such a feature involves multithreading in C++ and the raw handling of shared memory, which could not be achieved by this project's deadline. As a result, timeouts must be avoid by manually changing the MAXDEPTH constant found in board.h.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickersoft%2Fconnect-n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickersoft%2Fconnect-n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickersoft%2Fconnect-n/lists"}