Giter Site home page Giter Site logo

ricardoreves / 42-push-swap Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.83 MB

๐Ÿงฎ The Push swap project is a very simple and a highly straightforward algorithm project: data must be sorted.

License: MIT License

Makefile 3.40% C 61.52% Python 28.51% Shell 5.78% Perl 0.80%

42-push-swap's Introduction

42 Push Swap

Language Licence Score norminette

๐Ÿชง Overview

This project will make you sort data on a stack, with a limited set of instructions, using the lowest possible number of actions. To succeed youโ€™ll have to manipulate various types of algorithms and choose the most appropriate solution (out of many) for an optimized data sorting.

๐Ÿ“ท Preview

Console

root@a5df87da6a06:/project# ARG='4 8 2 11 -7 -6'; ./push_swap $ARG
ra
ra
pb
ra
pb
pb
rrb
pa
pa
pa
ra
ra
ra
pb
pb
pb
pa
pa
pa
ra
ra
ra

Visualizer

๐Ÿš€ Getting Started

  1. Clone the project.
git clone [email protected]:ricardoreves/42-push-swap.git
  1. Navigate to the project directory.
cd 42-push-swap
  1. Compile the push_swap.
make

๐Ÿ•น๏ธ Usage

  1. Run push_swap
# single argument
./push_swap "4 0 1 3 2"

# multiple arguments
./push_swap 4 0 1 3 2
  1. Run instructions checker
ARG='4 0 1 3 2'; ./push_swap $ARG | ./checker $ARG

๐Ÿ”ฌ Testing

Prerequisites

MacOS

  1. Install python
brew install python3

Debian/Ubuntu

  1. install python
sudp apt update
sudo apt install python3 python3-pip python3-venv
  1. Make a virtualenv
# create an environnement
python3 -m venv .env

# activate env
source ./.env/bin/activate
  1. Install dependancies
pip install -r requirements.txt

Usage

  1. Run average tester
make test
  • With 3 numbers, we need to sort it with not more than 3 instructions.
  • With 5 numbers, we need to sort it with not more than 12 instructions.
  • With 100 numbers, we can get
5 points if the size of the list of instructions is less than 700
4 points if the size of the list of instructions is less than 900
3 points if the size of the list of instructions is less than 1100
2 points if the size of the list of instructions is less than 1300
1 points if the size of the list of instructions is less than 1500
  • With 500 numbers, we can get
5 points if the size of the list of instructions is less than 5500
4 points if the size of the list of instructions is less than 7000
3 points if the size of the list of instructions is less than 8500
2 points if the size of the list of instructions is less than 10000
1 points if the size of the list of instructions is less than 11500
  1. Run visualizer
make viz

๐Ÿงฐ Tools

  • PushSwapVisualizer - This is a python GUI app that helps visualize how the 42 project push_swap project works.
  • PushSwapTester - This tester shows the performance of your push_swap program.

๐Ÿ“š References

๐Ÿ“ License

Distributed under the MIT License. See LICENSE for more information.

42-push-swap's People

Contributors

ricardoreves 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.