summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-11-12 16:42:46 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-11-12 16:43:45 -0500
commit0a1596627dad46627cb5e0ea60e8d5853fe9313e (patch)
treeb0d59a6ac9e01e67bfead9718d5d1b90df1afb46
parent7ba8c6acc5dacfe693a3cb671fbbb58019cc0e1c (diff)
Add PowerShell script for comparing radices
This is in contrib/ so that it's not a part of the regular program - I don't want to add an extra dependency for something that's doable (even if it takes some effort) without PowerShell.
-rw-r--r--contrib/multi_radix_info.ps183
1 files changed, 83 insertions, 0 deletions
diff --git a/contrib/multi_radix_info.ps1 b/contrib/multi_radix_info.ps1
new file mode 100644
index 0000000..13f0807
--- /dev/null
+++ b/contrib/multi_radix_info.ps1
@@ -0,0 +1,83 @@
+<#
+.SYNOPSIS
+Shows the radix info of many different radices.
+
+.DESCRIPTION
+Runs the radix_info script for a list of radices.
+It needs to be installed for this script to work.
+
+.PARAMETER Max
+This script will show all radices from 1 to this number.
+
+.PARAMETER Min2345Rank
+If specified, only shows radices whose 2345 rank's letter is at or above
+the specified letter:
+- Using 'A' only shows multiples of 12.
+- Using 'B' only shows multiples of 6.
+- Using 'C' only shows radices divisible by 4 or 6 (1/3 of all radices).
+- Using 'D' only shows even radices.
+- Using 'E' only shows radices divisible by 2 or 3 (2/3 of all radices).
+- Using 'F' shows all radices.
+
+.PARAMETER MoreDetails
+This script passes the -c flag to radix_info by default,
+specifying this disables that functionality.
+
+.PARAMETER DigitMapOnly
+Passes the -d flag to radix_info.
+
+.PARAMETER FullDigitMap
+Passes the -f flag to radix_info.
+
+.NOTES
+Copyright (C) 2023 Adrien Hopkins
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <https://www.gnu.org/licenses/>.
+#>
+param(
+ [int]$Max=30,
+ [char]$Min2345Rank='F',
+ [Switch]$MoreDetails,
+ [Switch]$DigitMapOnly,
+ [Switch]$FullDigitMap
+)
+
+2..$Max | ForEach-Object {
+ if ($_ % 2 -eq 0) {
+ if ($_ % 3 -eq 0) {
+ if ($_ % 4 -eq 0) {
+ $2345Rank = 'A'
+ } else {
+ $2345Rank = 'B'
+ }
+ } else {
+ if ($_ % 4 -eq 0) {
+ $2345Rank = 'C'
+ } else {
+ $2345Rank = 'D'
+ }
+ }
+ } else {
+ if ($_ % 3 -eq 0) {
+ $2345Rank = 'E'
+ } else {
+ $2345Rank = 'F'
+ }
+ }
+
+ if ($2345Rank -le $Min2345Rank) {
+ $CompactDisplay = -not $MoreDetails
+ radix_info -c="$CompactDisplay" -d="$DigitMapOnly" -f="$FullDigitMap" $_
+ }
+}