Implementation of various bots that will play/solve wikirace-game. In short, given seeking article, you need to find from other start article (depending on rules, maybe randomly chosed) as fast as you can by article links in page.
- Node.js version > 14.0
- Typescript (tsc for building project yourself)
git clone https://github.com/Yhtiyar/wikiracer.git
cd wikiracer/
npm i package.jsonnpm run wikiracer -- --start <start_page_url> --end <end_page_url> --agent <agent_name>Important : Urls should be in quotes!
Example:
npm run wikiracer -- --start "https://en.wikipedia.org/wiki/Asabea_Cropper" --end "https://en.wikipedia.org/wiki/Adolf_Hitler" --agent bfs--start "start_page"Wikipedia article where game starts--end "end_page"Seeking article--agent agent_nameName of the agent (bot) that will play game. See avaible agent here- Optional arguments:
--logLogs api request details--disable_fast_modeDisables fast mode
npm run build - project will build to compiledJS/ directory
Chooses random link everytime. You can use it to check if you lucky enough.
How to use in run argument : --agent random
Searches article by BFS algorithm. Works really fast to seach famous articles, as some famous politicians, countires. Struggles with seaarching specific articles.
How to use in run argument : --agent bfs
Improved search with priority queue, the articles that are familiar to seeking article will be looked first. Familiarty in this agent between 2 articles is defined as : number of categories that contain both articles. Works slow to search famous articles compared to Bfs agent, however works good in searching rare articles.
How to use in run argument : --agent agent_c
Experimental agent similar to Agent_C, however Levenshtein distance is used to measure familiarity. Average Levenshtein distance between articles of 2 pages represents how familiar are articles. But, distance measuring creates bottleneck, so it becmomes really slow. Not recommended to use it.
How to use in run argument : --agent agent_l
Every agent is in fast mode by default, it means it will search not more than 500 (first lexographically sorted) articles in each page. Since there some pages
with thousands of links, fast mode will improve agents performance. Searching works fine in this mode. You can disable it manually by passing --disable_fast_mode to run arguments
I have developed tests to test agents speed. Test consist of 3 categories.
- Easy, with famous articles.
- Middle, not popular articles.
- Hard, with very specific articles.
Each category consists of 3 tests. See all tests here
I have set time limit 10 minutes for Easy, 30 minutes for Middle tests and 1 hour for hard tests. I have only ran benchmark on BFS agent and Agent_C. (It is obvious that other 2 agents will fail time limit).
| Agent | Easy | Middle | Hard |
|---|---|---|---|
| BFS | 8.524s | tl fail | tl fail |
| Agent_C | 30m:27s (tl fail) | 3m:58s | 45m:36s |
Here are becnhmark logs.
- Use BFS agent for very popular articles
- Use Agent_C for others