summaryrefslogtreecommitdiff
path: root/contrib/multi_radix_info.ps1
blob: 13f0807e63538535a3cf4d4d24c7d47ee98f1efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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" $_
    }
}