GithubHelp home page GithubHelp logo

ascii-art-take-home's Introduction

Take Home Challenge: ASCII Graphics Library

╦ ╦┌─┐┌─┐┬┌─┌┐ ┬─┐┬┌─┐┬ ┬┌┬┐  ┬─┐┬ ┬┬  ┌─┐┌─┐┬
╠═╣├─┤│  ├┴┐├┴┐├┬┘││ ┬├─┤ │   ├┬┘│ ││  ├┤ └─┐│
╩ ╩┴ ┴└─┘┴ ┴└─┘┴└─┴└─┘┴ ┴ ┴   ┴└─└─┘┴─┘└─┘└─┘o

ASCII art is a term used to describe images that are made of text instead of pixels. It became a popular genre of art in the 70s-80s, back when computers could only handle displaying text on the screen. For example:

                   ,%%%,
                 ,%%%` %
                ,%%`( '|
               ,%%@ /\_/
     ,%.-"""--%%% "@@__
    %%/             |__`\
   .%'\     |   \   /  //
   ,%' >   .'----\ |  [/
      < <<`       ||
       `\\\       ||
         )\\      )\
 ^^^^^^^^"""^^^^^^""^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In this take home challenge, you'll implement a library in the language of your choice for drawing ASCII graphics.

Specifications

You'll be in charge of implementing the API for drawing rectangles (and squares). The API must be able to:

  • Render canvas with a specified height and width
    • Print the canvas and any shapes to standard output
  • Add a shape to a canvas
    • shape the shape to add. For now, assume you only have to deal with rectangles
  • Clear all shapes from a canvas
  • Create a rectangle
    • start_x is the X coordinate of the upper-left-hand corner of the rectangle
    • start_y is the Y coordinate of the upper-left-hand corner of the rectangle
    • end_x is the X coordinate of the lower-right-hand corner of the rectangle
    • end_y is the Y coordinate of the lower-right-hand corner of the rectangle
    • fill_char is the character that should be used to draw the rectangle
  • Change a rectangle's fill character
    • char the character to use in order to draw a pre-existing rectangle
  • Translate (move left, right, up, or down)
    • axis which axis ('x' or 'y') should we translate the rectangle on? Translating on the X-axis will cause the rectangle to move left and right. Translating on the Y-axis will cause the rectangle to move up and down.
    • num is how much to move the rectangle. Negative numbers will cause the rectangle to shift left or down. Positive numbers will cause the rectangle to shift right or up.

Notes

Rectangles can overlap with one another. The most recently added rectangle should appear on top of other rectangles. For example:

 ++++
 ++.....
 ++.....
   .....




Make sure you do not render any characters that are out of bounds.

Feel free to make decisions/assumptions about things you have questions about and please document these decisions (using comments in your solution is fine).

ascii-art-take-home's People

Contributors

atrnh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kjrosen

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.