GithubHelp home page GithubHelp logo

lem_in's Introduction

Lem_in

Find the shortest path to get n ants across a colony (comprised of rooms and tunnels).

At the beginning of the game, all the ants are in the room ##start. The goal is to bring them to the room ##end with as few moves as possible.

Each room can only contain one ant at a time (except at ##start and ##end which can contain as many ants as necessary).

The shortest path isn't necessarily the simplest. Some maps will have many rooms and many links, but no path between start and end. Some maps will have rooms that link to themselves, sending your path-search spinning in circles. Some maps will have too many/too few ants, no start or end, duplicate rooms, links to unknown rooms, rooms with invalid coordinates, and a variety of other invalid or poorly-formatted input. Ants will also need to avoid traffic jams (walking all over their fellow ants).

The project

Create the program lem-in. lem-in will read the map (describing the ants and the colony) from the sdtin.

Upon successfully finding the shortest path, lem-in will display the parsed input, and each ant's move from room to room. lemin

Approach

The map was similar to an undirected graph with unit vertex capacities. First i created the equivalent directed graph with unit edge capacities then starting from 1 i continued to augment the flow and count the score (number of lines to get all the ants from start to end) until i found an optimal solution. I used The Ford–Fulkerson method for finding augmenting paths and i implemented it using BFS.

Usage

Run make

$>./lem-in < map

lem_in's People

Contributors

ouzamhar avatar

Watchers

 avatar

lem_in's Issues

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.