Giter VIP home page Giter VIP logo

bouncingmarble's Introduction

BouncingMarble

Compile the program by specifiying the curses library. For example: gcc marblec.c -o marble -lcurses. To run the program type ./marble followed by the number of desired rows, the number of desired columns, a number between -2 and 2, inclusive (the speed in the x direction), and a number between -2 and 2, inclusive (the speed in the y direction). For example, ./marble 4 4 -1 2 would split the terminal into boxes with 4 rows and 4 columns. The cursor would be sent slowly to the left and quickly downwards (y increases as the cursor moves down in the terminal). As the cursor bounces around the terminal, you will be able to see the number of times it has entered each box. Press Ctrl-C to end the program.

Update (7/11/2022)

I realize that making sure the 'curses' library is installed properly can be quite the hassle, especially on a Windows machine. Therefore I have made changes that should make it so that this program can run on any machine. HOWEVER, YOU MUST HAVE DOCKER INSTALLED ON YOUR SYSTEM. If you meet this requirement, clone the repo as normal. Make sure Docker is running. Then, go to the root of the directory in your command line and enter docker build -t bouncingmarble .. This will create the Docker image. Then run docker run bouncingmarble and the program should run as intended.

If you would like to change the speed/number of boxes in the terminal go to Dockerfile in the root of the directory and change the last line to your specifications. For example, CMD ["./marble", "4", "4", "-1", "-2"] would split the terminal into boxes with 4 rows and 4 columns. The cursor would be sent slowly to the left and quickly downwards (y increases as the cursor moves down in the terminal). This will require you to rebuild the image and run the container again.

It is also possible to change the speed/number of boxes without completely rebuilding the image and running the container again. This can be done by running new commands within the container. To do so run a command similar to the following (while the Docker container is running): docker exec -it container_id /bin/sh (the container id of the running container can be found by running docker ps). This will allow you to enter new commands within the running container. Then you can run a command such as ./marble 4 4 -1 -2. This will run the program with the same effects as described in the paragraph above.

I am trying to get practice using Docker, and I remembered how annoying it was to run this program on Windows. Therefore, this was a great way to see if I could get the program to run on my Windows machine using Docker.

bouncingmarble's People

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.