Add-Type -AssemblyName System.Windows.Forms
# Thompson Chart maps
$thompsonChart = @{
Mirror = @{0=5; 1=6; 2=7; 3=8; 4=9; 5=0; 6=1; 7=2; 8=3; 9=4}
Carry = @{0=4; 1=5; 2=6; 3=7; 4=8; 5=9; 6=0; 7=1; 8=2; 9=3}
Flip1 = @{0=3; 1=4; 2=5; 3=6; 4=7; 5=8; 6=9; 7=0; 8=1; 9=2}
Flip2 = @{0=7; 1=8; 2=9; 3=0; 4=1; 5=2; 6=3; 7=4; 8=5; 9=6}
}
function Convert-Numbers {
param ($numbers, $method)
$chart = $thompsonChart[$method]
return $numbers | ForEach-Object { $chart[$_] }
}
# Create GUI
$form = New-Object Windows.Forms.Form
$form.Text = "Thompson Lottery Chart"
$form.Size = New-Object Drawing.Size(400,250)
$form.StartPosition = "CenterScreen"
# Input label and textbox
$label = New-Object Windows.Forms.Label
$label.Text = "Enter 4 digits (separated by space):"
$label.Location = New-Object Drawing.Point(20, 20)
$label.AutoSize = $true
$form.Controls.Add($label)
$inputBox = New-Object Windows.Forms.TextBox
$inputBox.Location = New-Object Drawing.Point(220, 18)
$inputBox.Size = New-Object Drawing.Size(140, 20)
$form.Controls.Add($inputBox)
# Dropdown for transformation
$combo = New-Object Windows.Forms.ComboBox
$combo.Location = New-Object Drawing.Point(20, 60)
$combo.Size = New-Object Drawing.Size(150, 20)
$combo.Items.AddRange(@("Mirror", "Carry", "Flip1", "Flip2"))
$combo.SelectedIndex = 0
$form.Controls.Add($combo)
# Button to convert
$button = New-Object Windows.Forms.Button
$button.Text = "Transform"
$button.Location = New-Object Drawing.Point(200, 58)
$form.Controls.Add($button)
# Output box
$outputLabel = New-Object Windows.Forms.Label
$outputLabel.Text = "Transformed:"
$outputLabel.Location = New-Object Drawing.Point(20, 100)
$outputLabel.AutoSize = $true
$form.Controls.Add($outputLabel)
$outputBox = New-Object Windows.Forms.TextBox
$outputBox.Location = New-Object Drawing.Point(110, 98)
$outputBox.Size = New-Object Drawing.Size(250, 20)
$outputBox.ReadOnly = $true
$form.Controls.Add($outputBox)
# Action on button click
$button.Add_Click({
$rawInput = $inputBox.Text.Trim()
$method = $combo.SelectedItem
if ($rawInput -match '^(\d\s+){3}\d$') {
$numbers = $rawInput -split '\s+' | ForEach-Object { [int]$_ }
$converted = Convert-Numbers -numbers $numbers -method $method
$outputBox.Text = ($converted -join " ")
} else {
[System.Windows.Forms.MessageBox]::Show("Please enter exactly 4 digits separated by spaces (e.g., 1 2 3 4).", "Input Error", "OK", "Error")
}
})
# Run the GUI
[void]$form.ShowDialog()