{"id":20253825,"url":"https://github.com/willprice/prolog-search-visualisation","last_synced_at":"2025-09-08T23:33:52.509Z","repository":{"id":66989987,"uuid":"85682367","full_name":"willprice/prolog-search-visualisation","owner":"willprice","description":" Web based visualisation of various search algorithms implemented in prolog for teaching","archived":false,"fork":false,"pushed_at":"2018-10-15T19:53:31.000Z","size":482,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-01T08:31:12.904Z","etag":null,"topics":["backtracking","backtracking-search","logic","prolog","search","visualisation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/willprice.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":"2017-03-21T09:23:05.000Z","updated_at":"2020-11-13T02:37:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"f1cacee5-ba9d-4bcb-8bf5-aceb798a20a4","html_url":"https://github.com/willprice/prolog-search-visualisation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/willprice/prolog-search-visualisation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willprice%2Fprolog-search-visualisation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willprice%2Fprolog-search-visualisation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willprice%2Fprolog-search-visualisation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willprice%2Fprolog-search-visualisation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willprice","download_url":"https://codeload.github.com/willprice/prolog-search-visualisation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willprice%2Fprolog-search-visualisation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231173,"owners_count":25245675,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["backtracking","backtracking-search","logic","prolog","search","visualisation"],"created_at":"2024-11-14T10:27:47.435Z","updated_at":"2025-09-08T23:33:52.488Z","avatar_url":"https://github.com/willprice.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Search Visualisation in Prolog\n\n[![Build Status](https://travis-ci.org/willprice/prolog-search-visualisation.svg?branch=master)](https://travis-ci.org/willprice/prolog-search-visualisation)\n\n[SWI-Prolog](http://www.swi-prolog.org/) based tracer for visualisation search\nalgorithms such as depth first, breadth first, best first, A*, ... search\n\n## Instructions\n\nInstall dependencies using `yarn` then run `./serve.sh` and visit\nhttp://localhost:4000\n\nHere's a demo of the visualisation:\n\n![Search visualisation demo GIF](demo-2017-04-28.gif)\n\n* The dark circle indicates the agent, it tracks the path through the search tree.\n* Light blue cells indicate those that have been visited by the algorithm.\n* Dark blue cells indicate those that are on the current path being explored.\n\n* The width/height of the grid can be adjusted\n* The search algorithm can be toggled through any that are implemented on the server\n* The starting position of the agent can be chosen by dragging the agent to the\n  desired starting cell\n* The goal position can be selected by clicking on a cell.\n* Searches can be aborted using the *reset* button\n\n## Implementing new search algorithms\n\nSearch algorithms are abstractly defined by the prolog record [`search_strategy`](./search.pl#L59-L63). Search strategies define methods for ...\n\n* Combining the current agenda with the agenda items created for the children\n  reachable from the current state\n* Computing the cost of an agenda item given `h` and `g` predicates\n* Depth bounds\n\nThe following predicates define a search strategy:\n\n* `combine_agenda(+OldAgenda:list(agenda_item), +ChildAgenda:list(agenda_item),\n  -NewAgenda:list(agenda_item))` combines `OldAgenda`, the current agenda\n  (minus the agenda item we popped off) and `ChildAgenda`, agenda items\n  corresponding to the children found by `children/2` defined in the\n  `search_problem`.\n* `cost(+G:callable/3, +H:callable/3, +From:state, +CostToCurrent:integer,\n  +To:state, -FCost:f(CostToNode:integer, HeuristicCostToGoal:integer))`\n  evaluates the child state `To` reachable from `From` using `G` and `H`,\n  predicates defining the cost of moving from `From` to `To` and from `To` to\n  a goal. Note that `G` differs from the its traditional definition in the\n  A algorithm literature, instead of computing the cost of a state from scratch\n  it is much easier to compute the cost difference of a single move in the\n  search true keeping a running total along a path.\n\n\n## Implementing new search problems\n\nSearch problems are abstractly defined by the prolog record [`search_problem`](./search_problem.pl), there are *two* example problems:\n\n* [grid search](./grid.pl)\n* [black-white counter puzzle](./black_white_puzzle.pl) (see the [Simply\n  Logical chapter](http://book.simply-logical.space/part_ii.html#informed_search) for\n  an explanation)\n\nSearch problems are defined by 5 predicates:\n\n* `start(-StartState:state)`, first argument unifies with the starting state of the search problem, e.g. the starting position of the agent in a grid search, or an initial board state in a game tree search.\n* `goal(+State:state)` holds if `State` is a goal state or not.\n* `children(+State:state, -ChildStates:list(state))` the reachable child states from `State`\n* `h(+State, -Cost:integer)`, cost unifies with the\n  [h-value](https://en.wikipedia.org/wiki/A*_search_algorithm) of `State`. The\n  h-value is the heuristic estimate for how must it costs to reach the goal\n  state from `State`.\n* `g(+State:state, -Cost:integer)`, cost unifies with the cost of reaching\n  `State` from the start state as defined by `start/1`.\n\nThe predicates are wrapped up into a `search_problem` record using `search_problem:make_search_record`.\n\nThe `state` type is user defined--the search algorithms are orthogonal to the representation, you can choose your state representation however you see fit.\n\n\n## Contributing\n\nSee [DEVELOPMENT.md](./DEVELOPMENT.md) for technical details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillprice%2Fprolog-search-visualisation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillprice%2Fprolog-search-visualisation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillprice%2Fprolog-search-visualisation/lists"}