Giter VIP home page Giter VIP logo

coin-grid's Introduction

A C program that finds recursively the best path to collect maximum possible coins.

Pathfinding function

You can change the function by which the program finds the path, by changing the defined identifier in robot_functions.h (default is MATRREC).
Pathfinding identifiers:
PUREREC = pure recursive
MATRREC = matrix recursion
ITERDP = iterative dynamic programming

PUREREC only outputs number of coins collected, not the path

Calling the program

The grid can be given either as a text file by running the program as:

$ ./robot < grid.txt

or by giving the grid after calling the program. The size of the grid must first be defined and then the grid must be given, by symbolizing C as cells with coins and . as empty cells:

$ ./robot < grid.txt
3 4
C..C
.C..
CC.C

Output

The program will output the found path and for each cell visited it will show if it had a cell or not, its coordinates and how many coins were collected until there, and finally the total number of coins collected.
e.g.

Path is: C(1,1)/1 --> .(1,2)/1 --> C(2,2)/2 --> C(3,2)/3 --> .(3,3)/3 --> C(3,4)/4 --> Picked up 4 coins

coin or empty(coordinates)/coins until that cell

coin-grid's People

Contributors

konstantinastoikou avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.