aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/plot.bat
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-06 21:45:45 +0200
committerEgor Tensin <egor@tensin.name>2026-06-06 21:45:45 +0200
commitfba834a617d2d2905cfc84595de100f8a5368c0a (patch)
tree2b629a72dacfec75a6cf28a298ff309602cfff5d /scripts/plot.bat
parentworkflows/ci: remove on: pull_request (diff)
downloadsorting-algorithms-fba834a617d2d2905cfc84595de100f8a5368c0a.tar.gz
sorting-algorithms-fba834a617d2d2905cfc84595de100f8a5368c0a.zip
sort out scripts into proper directories
Diffstat (limited to 'scripts/plot.bat')
-rw-r--r--scripts/plot.bat47
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/plot.bat b/scripts/plot.bat
new file mode 100644
index 0000000..c76c43a
--- /dev/null
+++ b/scripts/plot.bat
@@ -0,0 +1,47 @@
+@rem Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
+@rem This file is part of the "Sorting algorithms" project.
+@rem For details, see https://github.com/egor-tensin/sorting-algorithms.
+@rem Distributed under the MIT License.
+
+@setlocal enabledelayedexpansion
+@echo off
+
+set default_iterations=100
+set default_min=0
+set default_max=200
+
+if "%~1" == "" goto :exit_with_usage
+set "algorithm=%~1"
+
+if "%~2" == "" (
+ set "iterations=%default_iterations%"
+) else (
+ set "iterations=%~2"
+)
+if "%~3" == "" (
+ set "min=%default_min%"
+) else (
+ set "min=%~3"
+)
+if "%~4" == "" (
+ set "max=%default_max%"
+) else (
+ set "max=%~4"
+)
+
+cd ..
+mkdir /p img
+
+for %%i in (best average worst) do (
+ plot.py "%algorithm%" ^
+ --input "%%i" ^
+ --min "%min%" --max "%max%" ^
+ --iterations "%iterations%" ^
+ --output "img\%algorithm%_%iterations%_%%i_%min%_%max%.png" || exit /b !errorlevel!
+)
+
+exit /b 0
+
+:exit_with_usage:
+echo Usage: %~nx0 ALGORITHM [ITERATIONS [MIN_VALUE [MAX_VALUE]]]
+exit /b 1