{"id":21681101,"url":"https://github.com/albertsgrc/dancing-circle-optimizer","last_synced_at":"2026-01-27T21:17:58.476Z","repository":{"id":93333079,"uuid":"230500637","full_name":"albertsgrc/dancing-circle-optimizer","owner":"albertsgrc","description":"Find feasible dancing circles and optimize dancer pair height difference","archived":false,"fork":false,"pushed_at":"2020-01-10T16:08:14.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T21:05:24.240Z","etag":null,"topics":["constraint-satisfaction-problem","dance","optimization","sardana"],"latest_commit_sha":null,"homepage":"","language":"Prolog","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albertsgrc.png","metadata":{"files":{"readme":"README.adoc","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,"governance":null}},"created_at":"2019-12-27T19:00:15.000Z","updated_at":"2020-03-23T17:12:34.000Z","dependencies_parsed_at":"2023-03-10T05:15:46.486Z","dependency_job_id":null,"html_url":"https://github.com/albertsgrc/dancing-circle-optimizer","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"da749ceed0ca43854f144f381d0f1df455a118fe"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/albertsgrc/dancing-circle-optimizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertsgrc%2Fdancing-circle-optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertsgrc%2Fdancing-circle-optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertsgrc%2Fdancing-circle-optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertsgrc%2Fdancing-circle-optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albertsgrc","download_url":"https://codeload.github.com/albertsgrc/dancing-circle-optimizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertsgrc%2Fdancing-circle-optimizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28823191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["constraint-satisfaction-problem","dance","optimization","sardana"],"created_at":"2024-11-25T15:23:59.127Z","updated_at":"2026-01-27T21:17:58.458Z","avatar_url":"https://github.com/albertsgrc.png","language":"Prolog","funding_links":[],"categories":[],"sub_categories":[],"readme":"= dancing-circle-optimizer\n\nThe https://en.wikipedia.org/wiki/Sardana[Sardana] is a popular dance in Catalunya\nwhere men and women form a circle and dance while holding their hands. Commonly, if there are enough pairs of men `m` and women `w`, two dancers of the same gender do not hold hands in the circle, i.e they alternate each other:\n\n```\n                               m  -  w\n                            /           \\\n                          w               m\n                          |               |\n                          m               w\n                            \\           /\n                               w  -  m \n```\n\nIt is also the case that dancers dance more comfortably next\nto someone who has a similar height, because when heights are very different they have to adopt uncomfortable arm positions and the circle loses aesthetics.\n\nThis program accepts a list of man and woman dancers with their respective heights,\ntogether with a set of restrictions on who can dance next to who, \nand outputs a list of all the possible dancing circles sorted decreasingly by how good they are based on the criteria of height difference minimization.\n\n== Restrictions\n\nThe first lines of the `dancing-circle-optimizer.pl` source file specify the list of dancers, their heights and\nthe restrictions on who can dance together, who does not dance, etc.\n\n*Example:*\n\n```prolog\nmen([fabio-174, jordan-176, joe-180, george-171, eddard-172, tyrion-180, gregor-175]).\nwomen([cersei-165, sansa-171, melisandre-165, brienne-170, margaery-162, ygritte-168, missandei-164]).\n\n% RULE SEMANTICS\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% dancesOnRightSide(X, Y) \u003c=\u003e X must dance on the right side of Y\n\n% doesNotDanceOnRightSide(X, Y) \u003c=\u003e X cannot dance on the right side of Y\n% doesNotDance(X, Y) \u003c=\u003e X cannot dance with Y, on any side\n% doesNotDance(X) \u003c=\u003e X does not dance\n\n% doesNotDanceBetween(X, Y, Z) \u003c=\u003e Z cannot dance between X and Y\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n\n% MANUALLY SPECIFIED CONDITIONS\ndancesOnRightSide(sansa, tyrion).\n\ndoesNotDanceOnRightSide(cersei, jordan).\ndoesNotDanceOnRightSide(brienne, tyrion).\ndoesNotDance(george, brienne).\ndoesNotDance(fabio, cersei).\ndoesNotDanceOnRightSide(george, cersei).\n\ndoesNotDance(margaery).\ndoesNotDance(gregor).\n\ndoesNotDanceBetween(george, eddard, _). % No one can dance between these two men\n```\n\nYou can include your own dancers and restrictions by manually changing this section of\nthe source code, just follow the same definition format as the example.\n\n== Building\n\nhttps://www.swi-prolog.org/[SWI Prolog] must be installed in your system.\n\nRun `make` to compile the prolog program.\n\n== Running\n\nRun `./dancing-circle-optimizer`. It will output a list with all the\npossible dancing circles, sorted increasingly by score, where a higher score\nmeans the dancing circle is worse.\n\n*Example output:*\n\n```\n-eddard-ygritte-joe-sansa-tyrion-brienne-jordan-cersei-george-missandei-fabio-melisandre (2074)\n-eddard-ygritte-joe-sansa-tyrion-brienne-jordan-cersei-george-melisandre-fabio-missandei (2076)\n-eddard-brienne-joe-sansa-tyrion-ygritte-jordan-cersei-george-missandei-fabio-melisandre (2090)\n-eddard-brienne-joe-sansa-tyrion-ygritte-jordan-cersei-george-melisandre-fabio-missandei (2092)\n-eddard-cersei-joe-sansa-tyrion-brienne-jordan-ygritte-george-missandei-fabio-melisandre (2104)\n-george-ygritte-jordan-brienne-joe-sansa-tyrion-cersei-eddard-melisandre-fabio-missandei (2104)\n-eddard-sansa-tyrion-brienne-joe-ygritte-jordan-cersei-george-missandei-fabio-melisandre (2106)\n-george-ygritte-jordan-brienne-joe-sansa-tyrion-cersei-eddard-missandei-fabio-melisandre (2106)\n-eddard-cersei-joe-sansa-tyrion-brienne-jordan-ygritte-george-melisandre-fabio-missandei (2106)\n-eddard-sansa-tyrion-brienne-joe-ygritte-jordan-cersei-george-melisandre-fabio-missandei (2108)\n-eddard-melisandre-joe-sansa-tyrion-brienne-jordan-cersei-george-missandei-fabio-ygritte (2110)\n-eddard-cersei-joe-sansa-tyrion-brienne-jordan-melisandre-george-missandei-fabio-ygritte (2110)\n-george-melisandre-jordan-brienne-joe-sansa-tyrion-cersei-eddard-ygritte-fabio-missandei (2110)\n-george-ygritte-jordan-sansa-tyrion-brienne-joe-cersei-eddard-melisandre-fabio-missandei (2112)\n-george-missandei-jordan-brienne-joe-sansa-tyrion-cersei-eddard-ygritte-fabio-melisandre (2114)\n-george-ygritte-jordan-sansa-tyrion-brienne-joe-cersei-eddard-missandei-fabio-melisandre (2114)\n-eddard-cersei-joe-sansa-tyrion-brienne-jordan-missandei-george-melisandre-fabio-ygritte (2114)\n-george-melisandre-jordan-brienne-joe-sansa-tyrion-cersei-eddard-missandei-fabio-ygritte (2118)\n-eddard-melisandre-joe-sansa-tyrion-brienne-jordan-cersei-george-ygritte-fabio-missandei (2118)\n-eddard-cersei-joe-sansa-tyrion-brienne-jordan-melisandre-george-ygritte-fabio-missandei (2118)\n-george-melisandre-jordan-sansa-tyrion-brienne-joe-cersei-eddard-ygritte-fabio-missandei (2118)\n-eddard-cersei-joe-sansa-tyrion-brienne-jordan-missandei-george-ygritte-fabio-melisandre (2120)\n-george-missandei-jordan-brienne-joe-sansa-tyrion-cersei-eddard-melisandre-fabio-ygritte (2120)\n-eddard-sansa-tyrion-ygritte-joe-brienne-jordan-cersei-george-missandei-fabio-melisandre (2122)\n-george-missandei-jordan-sansa-tyrion-brienne-joe-cersei-eddard-ygritte-fabio-melisandre (2122)\n-eddard-missandei-joe-sansa-tyrion-brienne-jordan-cersei-george-melisandre-fabio-ygritte (2124)\n-eddard-sansa-tyrion-ygritte-joe-brienne-jordan-cersei-george-melisandre-fabio-missandei (2124)\n-george-melisandre-jordan-sansa-tyrion-brienne-joe-cersei-eddard-missandei-fabio-ygritte (2126)\n-george-missandei-jordan-sansa-tyrion-brienne-joe-cersei-eddard-melisandre-fabio-ygritte (2128)\n.    \n.\n.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertsgrc%2Fdancing-circle-optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertsgrc%2Fdancing-circle-optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertsgrc%2Fdancing-circle-optimizer/lists"}