Code Monkey home page Code Monkey logo

bsq's Introduction

 /$$$$$$$   /$$$$$$   /$$$$$$ 
| $$__  $$ /$$__  $$ /$$__  $$
| $$  \ $$| $$  \__/| $$  \ $$
| $$$$$$$ |  $$$$$$ | $$  | $$
| $$__  $$ \____  $$| $$  | $$
| $$  \ $$ /$$  \ $$| $$/$$ $$
| $$$$$$$/|  $$$$$$/|  $$$$$$/
|_______/  \______/  \____ $$$
                          \__/

Grade : B | Mark : 19.8/22

Description

You must find the largest possible square on a board while avoiding obstacles.

The board can be generated two ways. The first one is by reading a file passed as the program’s argument. The file is valid if it is respecting those constraints:

  • its first line contains the number of lines on the board (and only that),
  • “.” (representing an empty place) and “o” (representing an obstacle) ar ethe only two characters for the other lines,
  • all of the lines are of the same length (except the first one),
  • it contains at least one line,
  • each line is terminated by ‘\n’.

You program must print the board, with some “.” replaced by “x” to represent the largest square you found.

If ever there are several solutions, you have to represent only the highest square. If they are still several solutions, choose the square to the left.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See program usage for notes on how to use the project after having it installed.

Prerequisites

  • gcc
  • make

Fedora:

sudo dnf install gcc make

Ubuntu / Debian:

sudo apt-get install gcc make

Arch:

sudo pacman -S install gcc make

MacOs:

brew install gcc make

Installation

First, clone this repository and go into it :

git clone https://github.com/AdrienL06/bsq && cd bsq/

Compile the project:

make

Program usage

bsq expects a map given in argument.

Using a predefinite map

USAGE
    ./bsq maps-intermediate/mouli_maps/[map.txt]
DESCRIPTION
    map.txt file containing the map in which to search the biggest square

Generating your own

The second way to obtain a board is to generate one based on given parameters.

USAGE
    ./bsq nbr "pattern"
DESCRIPTION
    nbr number representing the width and height of the board
    pattern pattern that will be repeated line by line along the board

For example :

❯ ./bsq 10 "...ooo..."
...oooxxx.
..ooo.xxx.
.ooo..xxx.
ooo......o
oo......oo
o......ooo
......ooo.
.....ooo..
....ooo...
...ooo....
❯ 

Built With

  • C - Main language used

Authors

bsq's People

Contributors

lelouch178 avatar

Stargazers

 avatar  avatar

Watchers

 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.