{"id":13713590,"url":"https://github.com/jojorancu/NQueen","last_synced_at":"2025-05-06T23:32:26.443Z","repository":{"id":86226037,"uuid":"141655285","full_name":"jojorancu/NQueen","owner":"jojorancu","description":"Basically it is a solution for \"N-Queen\" Problem. I added mix of humor to the code. Sounds like \"The King\" wanted date all \"The Queen\" :)","archived":false,"fork":false,"pushed_at":"2018-07-22T15:03:28.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-14T00:34:00.245Z","etag":null,"topics":["algorithm","go","golang","nqueens-problem"],"latest_commit_sha":null,"homepage":"","language":"Go","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/jojorancu.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":"2018-07-20T02:48:40.000Z","updated_at":"2023-02-27T20:43:52.000Z","dependencies_parsed_at":"2023-03-08T00:45:43.687Z","dependency_job_id":null,"html_url":"https://github.com/jojorancu/NQueen","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/jojorancu%2FNQueen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojorancu%2FNQueen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojorancu%2FNQueen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojorancu%2FNQueen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jojorancu","download_url":"https://codeload.github.com/jojorancu/NQueen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252787534,"owners_count":21804277,"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":["algorithm","go","golang","nqueens-problem"],"created_at":"2024-08-02T23:01:39.965Z","updated_at":"2025-05-06T23:32:26.142Z","avatar_url":"https://github.com/jojorancu.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/jojorancu/NQueen.svg?branch=master)](https://travis-ci.org/jojorancu/NQueen)\n# NQueen - Problem\n\nBasically this is a way of N-Queen problem could be solved by using **`DFS-Backtracking Algorithm`** and of course recursively.\n\nAuthor added mix of humor to the code e.g. `firstLady` until `eigthBaby`is a named variable for testing purposes that points to the **first queen** until the **last queen** to be added (since currently the N is 8 for my testing code).\n\nAnother example is `Board` struct has `AbleToDate` function like this:\n```go\nfunc (b *Board) AbleToDate(homewrecker Queen) bool {\n\tfor _, queen := range b.Queens {\n\t\tif homewrecker.MadnessPotential(queen) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n```\nThis function check whether the `homeWrecker` as a `Queen` could be able to fill up the list `Queens` that `Board` has or not.\n\nI know right, you might found another one function that `Queen` has. `MadnessPotential` function contain all the constraints **OR** you could say the ***requirements*** that fulfill to date **`The King`**.\nAnd... ***Ba Dum Tss*** here are the ***requirements*** :\n* There should not be Queens on the same **row**.\n* And Queens are not allowed on the same **column** too.\n* Queens are also not allowed on the same **diagonal**.\n\n*Voila!* Here is the function:\n```go\nfunc (q1 *Queen) MadnessPotential(q2 Queen) bool {\n\treturn q1.X == q2.X || q1.Y == q2.Y || math.Abs(float64(q1.X-q2.X)) == math.Abs(float64(q1.Y-q2.Y))\n}\n```\n\n## Usage\nThis repository doesn't have any dependency to any library. Create new directory:\n```sh\ncd /to/your/dev/dir\nmkdir nameyouwanted\ncd nameyouwanted\n```\nUsing `git clone` to pull the repository:\n```sh\ngit clone https://github.com/jojorancu/NQueen.git\n```\nThere will be **`NQueen`** directory contains the code. \n\n## Test\nWanted to test ? Change the directory to the **`NQueen`** directory:\n```sh\ncd NQueen/\n```\n\nUse this syntax at the root directory:\n```sh\ngo test -v ./...\n```\n\n## Author\n[@jojorancu](https://twitter.com/jojorancu \"jojorancu / CJSparrow / Jonathan Surya Laksana\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjojorancu%2FNQueen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjojorancu%2FNQueen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjojorancu%2FNQueen/lists"}