Giter VIP home page Giter VIP logo

42pushswap's Introduction

42PushSwap

This project will make you sort data on a stack, with a limited set of instructions, usingthe lowest possible number of actions. To succeed you’ll have to manipulate varioustypes of algorithms and choose the one (of many) most appropriate solution for anoptimized data sorting.

Number of approaches in movements

  • 2n: 2 Moves
  • 3n: Between 2 and 3 movements
  • 5n: Between 7 and 12 movements
  • 100n: Between 500 and 700 movements
  • ./500n: Between 5100 and 5500 movements

Push_swap

Prerequisites

This project is for Mac OS.

Installation

Running

  • make

  • Run program with ./push_swap 3 5 7

Run push_swap with ramdons autogenerated numbers:

ARG=`ruby -e "puts (-0..100).to_a.shuffle.join(' ')"`; ./push_swap $ARG

Count the operations:

ARG=`ruby -e "puts (0..100).to_a.shuffle.join(' ')"`; ./push_swap $ARG | wc -l

Useful Links

Visualizer

move <pyviz.py> to main folder To execute it:

python3 pyviz.py `ruby -e "puts (-0..100).to_a.shuffle.join(' ')"`

Tester

Rename checker_mac to checker. Move <genstack.pl> to main folder.

chmod 744 genstack.pl
chmod 744 checker

To execute it:

bash push_swap_tester/tester.sh . 0-10 5

Sanitize

Add -g in gcc command.

-fsanitize=leak
-fsanitize=address

Print traces

Add in header file this define:

# define PRINT_HERE() (printf("file: %s, line: %d\n", __FILE__, __LINE__))

And used it from any part of your program

PRINT_HERE();

42pushswap's People

Contributors

mleganes avatar

Stargazers

 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.