├── .gitattributes ├── dice-simulator-PySimpleGUI.py ├── LICENSE ├── dice-simulator-terminal.py └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /dice-simulator-PySimpleGUI.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | import PySimpleGUI as sg 3 | 4 | sg.theme('Purple') 5 | 6 | layout = [ 7 | [sg.Text("What dice do you want to roll? [4/6/8/10/12/20/100]")], 8 | [sg.Input('', key='-INPUT-')], 9 | [sg.Output(key= '-OUTPUT-')], 10 | [sg.Button('Ok'), sg.Button('Quit')], 11 | ] 12 | 13 | window = sg.Window("Dice Simulator", layout) 14 | 15 | while True: 16 | events, values = window.Read() 17 | if events == sg.WINDOW_CLOSED or events == 'Quit': 18 | break 19 | dice_type = int(values['-INPUT-']) 20 | if dice_type in (4, 6, 8, 10, 12, 20, 100): 21 | dice = randint(1, dice_type) 22 | window['-OUTPUT-'].update('The value is: ' + str(dice)) 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Lauro Brant 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dice-simulator-terminal.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | choice = ' ' 3 | 4 | print(''' 5 | ____ _ ____ _ _ _ 6 | | _ \(_) ___ ___ / ___|(_)_ __ ___ _ _| | __ _| |_ ___ _ __ 7 | | | | | |/ __/ _ \ \___ \| | '_ ` _ \| | | | |/ _` | __/ _ \| '__| 8 | | |_| | | (_| __/ ___) | | | | | | | |_| | | (_| | || (_) | | 9 | |____/|_|\___\___| |____/|_|_| |_| |_|\__,_|_|\__,_|\__\___/|_| 10 | 11 | ''') 12 | 13 | while True: 14 | while choice not in 'NY': 15 | choice = input('Do you want to roll a dice? [Y/N] ').upper().strip()[0] 16 | if choice == 'N': 17 | break 18 | choice = ' ' 19 | if choice == 'Y': 20 | choice_dice = 0 21 | while choice_dice not in (4, 6, 8, 10, 12, 20, 100): 22 | choice_dice = int(input('What dice do you want to roll? [4/6/8/10/12/20/100] ')) 23 | dice = randint(1, choice_dice) 24 | print(dice) 25 | dice = 0 26 | choice_dice = ' ' 27 | choice = ' ' 28 | 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Dice Simulator 🎲

2 | 3 |

4 | A Simple Python Dice Simulator 🧩 🎮
5 | GitHub stars 6 | GitHub followers 7 |

8 |

9 | dice-simulator 10 |

11 | 12 | ## 💭 Description: 13 | 14 |

15 | That program make your RPG session more easy and simple. Roll the dice never been easier and fun. 16 |

17 | 18 | ``` 19 | ____ _ ____ _ _ _ 20 | | _ \(_) ___ ___ / ___|(_)_ __ ___ _ _| | __ _| |_ ___ _ __ 21 | | | | | |/ __/ _ \ \___ \| | '_ ` _ \| | | | |/ _` | __/ _ \| '__| 22 | | |_| | | (_| __/ ___) | | | | | | | |_| | | (_| | || (_) | | 23 | |____/|_|\___\___| |____/|_|_| |_| |_|\__,_|_|\__,_|\__\___/|_| 24 | 25 | ``` 26 | 27 | ## 🕹️ Usage: 28 | 29 | ### On Terminal: 30 | 31 |

32 | If you want to play this on a terminal, you need to run the program on your favorite terminal using VsCode or other source-code editor. Don't forget to verify that you have a Python interpreter installed on your machine. Then you just need to say yes and choose what die to you want to roll (D4, D6, D8, D10, D12, D20, D100). The result will show up 33 |

34 | 35 | #### Example: 36 | 37 |

38 | dice-simulator-terminal 39 |

40 | 41 | ### On the UI 42 |

43 | If you want to play this using the UI made using PySimpleGUI, you have to install PySimpleGUI click here to Install. So after the installation, you need to run the program on your favorite terminal using VsCode or other source-code editor. Don't forget to verify that you have a Python interpreter installed on your machine. Then you just need to choose what die to you want to roll (D4, D6, D8, D10, D12, D20, D100), and press "Ok". The result will show up 44 |

45 | 46 | #### Example: 47 |

48 | dice-simulator-ui 49 |

50 | 51 | ## ⚈ Download: 52 | 53 | [Click Here](https://github.com/BrantLauro/dice-simulator/releases/) to download. 54 | 55 | ## 💻 Tech Stack: 56 | 57 | The following tools were used in the construction of the project: 58 | - [Python](https://www.python.org/) 59 | - [PySimpleGUI](https://github.com/PySimpleGUI/PySimpleGUI) 60 | 61 | 62 | ### ©️ Copyrights 63 | 64 | Licensed with MIT. This README.md was based on the README.md of [CleoMenezes](https://github.com/CleoMenezes) on the repo [messageToCarbon](https://github.com/CleoMenezes/messageToCarbon). Therefore All rights reserved to [CleoMenezes](https://github.com/CleoMenezes) 65 | 66 | --- 67 | 68 | > LinkedIn [Lauro Brant](https://www.linkedin.com/in/lauro-brant-4858861b3/)  ·  69 | > GitHub [BrantLauro](https://github.com/BrantLauro)  ·  70 | > Twitter [@BrantLauro](https://twitter.com/BrantLauro)  ·  71 | > Instagram [@brantlauro](https://www.instagram.com/brantlauro/)  ·  72 | --------------------------------------------------------------------------------