aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-21 17:26:54 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-21 17:30:16 +0100
commitaaba527e44d763c83d0109e833150d4c0e6d4e56 (patch)
treeab7e3f7fea84176bc02e34f037bfa67bc40d2472 /README.md
parente80d3b18ebffc4eb882e9ffc474c7251aae52b51 (diff)
downloadpush_swap-aaba527e44d763c83d0109e833150d4c0e6d4e56.tar.gz
push_swap-aaba527e44d763c83d0109e833150d4c0e6d4e56.tar.bz2
push_swap-aaba527e44d763c83d0109e833150d4c0e6d4e56.zip
Added benchmark and updated README
Diffstat (limited to 'README.md')
-rw-r--r--README.md49
1 files changed, 49 insertions, 0 deletions
diff --git a/README.md b/README.md
index dd79553..f39779a 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,52 @@
# push_swap
push_swap project of school 42
+
+# Goal
+
+We have 2 stack at our disposal A and B.
+Stack A is given has an argument to our program,
+we have to sort it using only a limited set of operand.
+
+* `sa` swap the 2 topmost element of A
+* `sb` swap the 2 topmost element of B
+* `ss` swap the 2 topmost element of A & B
+* `pa` pop top of B and push it to A
+* `pb` pop top of A and push it to B
+* `ra` rotate A, everything is shifted up (top becomes bottom)
+* `rb` rotate B
+* `rr` rotate A & B
+* `rra` reverse rotate A,
+ everything is shifted down (bottom becomes top)
+* `rrb` reverse rotate B
+* `rrr` reverse rotate A & B
+
+# Usage
+
+```
+make all
+export ARG=$(echo ./random_stack.rb 1 20)
+./push_swap $(echo $ARG) | ./checker $(echo $ARG)
+```
+
+# Visualizer
+
+```
+export ARG=$(echo ./random_stack.rb 1 20)
+./push_swap $(echo $ARG) | ./visualizer.rb $(echo $ARG)
+```
+
+# Benchmark
+
+Make sure to have Python3.6 >=
+
+```
+python benchmark.py 10 100 5 10
+python benchmark_plot.py
+```
+
+Plot operation distribution
+
+```
+python benchmark_plot.py --dist
+```