GithubHelp home page GithubHelp logo

rc3-cert-cube-solver's Introduction

rc3 CERT Cube Solver

This is a solver for the "CERT Cube", a maze in the virtual world at rc3 event 2020 and following.

The solver works by using Selenium to remote-control a web browser window, and walk through all rooms to explore the maze. This is used to create a graph of all rooms and their exits, which is saved as JSON file. Afterwards the graph information can be used to find the shortest path through the maze.

Note that exploring the maze can take several hours. In my successful run for rc3 2020, the bot explored 126 rooms and 499 connections until it found the exit. The first ca. 80 rooms were explored within maybe an hour or less, because they were closely connected. The remaining rooms took a long time, because they required repeatedly walking through long one-way connections.

Installation

  • install Python packages:
virtualenv venv
source venv/bin/activate
pip install selenium graphviz webdriver-manager

Usage

  • create directory for results:
    mkdir run1

  • start Selenium browser window (in background):
    ./start_driver.py https://rc3.world &

  • in the browser window:

  • start the explorer script (use the "driver URL" and "driver session" printed by start_driver.py):
    ./explore_cube.py run1/rooms.json http://127.0.0.1:46079 da974f8e950add8979c15aaca8c4842f

While running, the explorer code will add newly collected room information to the supplied JSON file. It will also create backup files of the JSON file whenever new information is discovered (to avoid loosing all data if the JSON file gets broken by the script). The backup files will be created in the same directory where the main JSON file is created.

You can view the gathered room information like this:

./create_dot_graph.py run1/rooms.json run1/rooms.dot
sfdp -x -Goverlap=scale -Tpng run1/rooms.dot > run1/rooms.png

When the exit room has been found, the bot will quit with an error (but unfortunately it will not add the final room to the JSON file). Therefore you have to edit the JSON file manually and add an entry for the exit room (without any directions). Then use find_path.py to show the full path from any room to any other room, eg.:
./find_path.py run1/rooms.json 1190 1683

Known Problems

There a some cases which the explorer code doesn't cannot handle, and where it will therefore quit:

  • if a room exit leads into the same room again (since the explorer code waits for the room number to change, it will keep walking through that exit)
    • the script will give up after a few seconds and will quit
    • solution: manually edit the room JSON file and add this connection, the restart the script
  • if a "connection lost..." screen appears, which may occur if the backend is too slow
    • again, the script will give up after a few seconds and will quit
    • solution: restart the script once the backend is less overloaded
  • when the exit room is found, the bot cannot reach any other room and will again quit. See the Usage section for details.

Also, I haven't tested the code after cleaning it up (cardinal sin, I know; but the maze server was already shut down). Therefore the current code might have bugs that were introduced during cleanup. If unsure, check out the very first commit; that code was actually used successfully (but is difficult to use).

Results for Successful Run on "okmvqn" Maze Iteration (rc3 2020)

The room graph for the last successful run in the 2020 rc3 maze setup (with identifier "okmvqn") are stored in results-okmvqn/ subdirectory. The exit room in that setup has ID 1683.

Results for Successful Run on "snfzvo" Maze Iteration (rc3 2021)

The room graph for the last successful run in the 2021 rc3 maze setup (with identifier "snfzvo") are stored in results-snfzvo/ subdirectory. The exit room in that setup has ID 2312.

rc3-cert-cube-solver's People

Contributors

oliver avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

punki

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.