The Freedom to Roll While Incarcerated!
Now is the time to display my gratitude to my country! Let me not perish from this earth with even a single person able to say that I did not contribute!
I present to you the Amazing Die Device!
There is an enormous problem in the United States: prisoners of all types have been restricted from being able to pretend that they are elves and shit because they can't own dice in the pokey. How would you feel? Don't think it could happen to you? Dear reader, if there is one thing that I do know, it's that every single citizen in the United States of America has the opportunity to go to jail.
There was some small association with dice and devilry in the past, and you mix D&D with that, and those boys just might open a portal to hell.
But reading opens minds, and more importantly, hearts. Different voices heard, new emotions felt, new perspectives seen.
Was Plato really correct? Do we not do virtue until we know virtue? And when we know virtue, will we then act virtuously? I don't know. But I do believe that virtue can be taught through example, just as vice. I am told that to survive in those brutal fantasy worlds, you must work with your party. Assisting each other, taking responsibility for each other. Communicating with each other at first to increase the fun, and then, perhaps, to demonstrate friendship and comradery.
And they have no problem keeping a group together.
The lack of random number generators is a scourge that I can countenance no longer!
The Solution is at Hand!
Clearly, the solution is robots. As such, I have written a small piece of junior high level java code, that will no doubt lead to trouble.
Please find my imagined use case below!
I expect the IT guy can figure it out sufficiently to put it on a computer, then the front desk guard, (I wanna call him a concierge, but I don't think that's right.) can just run the program and call out the rolls. So Tony can shout, 'Hey Phil, can you roll a d20 for us, please?' Then Phil can roll it and tell Tony what the result was.
That way, Dungeons and Dragons and those dice will never cross paths, leading to some saturation of eldritch energy that, you guessed it, will never open a gateway to hell. Which will never lead to the subsequent mass absquatulation.
Crisis averted.
package tryingtogetitintheshell;import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Label;
import java.util.Random;
public class TheAmazingDieDevice {
private static final int SHELL_WIDTH = 625;
private static final int SHELL_HEIGHT = 200;
private static final int LABEL_X = 10;
private static final int LABEL_Y = 14;
private static final int LABEL_WIDTH = 150;
private static final int LABEL_HEIGHT = 25;
private static final int RESULT_X = 10;
private static final int RESULT_Y = 70;
private static final int RESULT_WIDTH = 600;
private static final int RESULT_HEIGHT = 50;
private static final int SIDES_X = 180;
private static final int SIDES_Y = 10;
private static final int SIDES_WIDTH = 100;
private static final int SIDES_HEIGHT = 25;
private static final int BUTTON_X = 262;
private static final int BUTTON_Y = 40;
private static final int BUTTON_WIDTH = 100;
private static final int BUTTON_HEIGHT = 25;
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("The Amazing Die Device");
shell.setSize(SHELL_WIDTH, SHELL_HEIGHT);
// Create a Label for the number of sides
Label lblSides = new Label(shell, SWT.NONE);
lblSides.setBounds(LABEL_X, LABEL_Y, LABEL_WIDTH, LABEL_HEIGHT);
lblSides.setText("How many sided die?");
// Create a text field to display the result
Text txtResult = new Text(shell, SWT.BORDER | SWT.MULTI | SWT.WRAP);
txtResult.setBounds(RESULT_X, RESULT_Y, RESULT_WIDTH, RESULT_HEIGHT);
// Create a text field for the number of sides
Text txtSides = new Text(shell, SWT.BORDER);
txtSides.setBounds(SIDES_X, SIDES_Y, SIDES_WIDTH, SIDES_HEIGHT);
// Create a button to roll the die
Button btnRoll = new Button(shell, SWT.NONE);
btnRoll.setBounds(BUTTON_X, BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT);
btnRoll.setText("Roll Die");
// Create a key listener to check for enter key being pressed instead of
// interaction with button.
txtSides.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.keyCode == SWT.CR) {
btnRoll.notifyListeners(SWT.Selection, new Event());
}
}
});
// Add a selection listener to the roll die button
btnRoll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
int intSides = Integer.parseInt(txtSides.getText());
String[] funnyPhrases = { "The sound of one hand clapping.", "You were the chosen one!",
"Looks like you rolled a 1-sided die!", "Do you really need my help with that one?",
"Spatial constraints know you not!", "You are a straight up whipper-snapper.",
"Are you trying to roll a 1?", "1 is the new hotness!", "The odds were ever in your favor!",
"It's like you planned it!", "You've got the luck of the Irish!",
"You're a natural at rolling 1s!", "The 1-sided die loves you!",
"I object to the intentional fumble, quick someone get a pen and paper, we have letters to write!",
"I see you've rolled a 1. Time to re-roll your character sheet into a coaster!" };
if (intSides == 1) {
Random random = new Random();
int randomIndex = random.nextInt(funnyPhrases.length);
if (!shell.isDisposed()) {
txtResult.setText(funnyPhrases[randomIndex]);
}
} else if (intSides <= 0) {
txtResult.setText("That isn't a valid number of sides.");
} else {
Random random = new Random();
int result = random.nextInt(intSides) + 1;
System.out.println("Generated random number: " + result); // Print the generated random number
// Check to see if the shell is disposed of before updating the label
if (!shell.isDisposed()) {
txtResult.setText("Rolling " + intSides + " sided die. Result is: " + result);
}
}
} catch (NumberFormatException nfe) {
txtResult.setText("That isn't a valid number of sides.");
}
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
}
Freeeeeedom! Copyright Eric Sangster, and like eight LLMs that frankly lie constantly for the code bit. But this license is given freely to the world.
Please remember the people of Ukraine. Their endeavor is righteous.