Hi! Cool project! From a (very) fast read, here are three small improvements ideas that would make your code cleaner/more pythonic: - You have a lot of "select random value from a list" and you generally use the length - there is a better way: random.choice(list) - https://docs.python.org/3/library/random.html#functions-for-sequences - You have a lot of string concatenation - there may be a better way with string interpolation alias "f-string" - example here: https://realpython.com/python-f-strings/#simple-syntax - You have to format numbers to string, with some custom code to be sure they are aligned properly if the attribute has a single digit value - this operation is called "padding" and Python has support for it: https://thispointer.com/python-how-to-pad-strings-with-zero-space-or-some-other-character/ Answer from vanakenm on reddit.com
🌐
PyPI
pypi.org › project › dnd-character
dnd-character · PyPI
You can use this library as a CLI tool to generate character sheets from the terminal; see python -m dnd_character --help for details.
      » pip install dnd-character
    
Published   Jul 30, 2023
Version   23.7.29
🌐
Reddit
reddit.com › r/python › i made a d&d 5e character generator in python, could i get some feedback on the code?
r/Python on Reddit: I made a D&D 5e Character Generator in Python, could I get some feedback on the code?
March 17, 2021 -

I made this as a quarantine project probably some time around May/June of last year. It was made in a span of probably a week or two. What initially made me think about making a character generator was that back when we were allowed to play D&D our group was somewhat notorious for accidentally stumbling on random NPCs and I figured something like this could help a DM out if they use a laptop while they run their game.

This project was also my foray into Python, and was just for fun.

I wanted to post it here to get some feedback on what I could do better because I'm sure parts of it are very sloppy.

https://github.com/ThatCoolNerd/dnd_5e_character_generator

Some things that I think could be improved:

  • How the stereotypical alignment and class is generated

  • How the stats are optimized on a per-class basis

  • How names are selected

Thanks for reading!

Discussions

Rolling Stats for a DND Character in Python - Stack Overflow
I've been trying to teach myself ... make a DND 5E Character Generator in Python 3.5 for personal use. I've built a simple one so far that'll give you a Class, Gender, Race, and Background. But I really want to flesh it out a ton more over time. Eventually I'd like to have it do everything involved in character creation and type it into a PDF character sheet... More on stackoverflow.com
🌐 stackoverflow.com
list - Dungeons and Dragons Character Sheet generator using Python - Stack Overflow
For fun I'm trying to create a character generator sheet for Dungeons and Dragons. I've got the program to randomly roll for my strength, charisma etc. Now I want to be able to ask the user, "... More on stackoverflow.com
🌐 stackoverflow.com
Any D&D fans want to check out my Random Character Generator?

Your code is really clean. It almost respect pep-8. Try to install flake8 and check your code:

flake8 main.py

I am a big fan of docstring that will make your functions shine more ! My favorite format is the google one, but numpy is also a good choice.

For example your die function in functions.py would look like:

def die(count: int, size: int = 6):
    """ Generate dice rolls

    Args:
        count: number of rolls
        size: number of faces

    Returns:
        list of rolls
    """
    dice = [randint(1, size) for _ in range(count)]
    return dice

Finally the last bit of advice would be about organization of your files. We usually put the functions/classes in a specific folder. You could for example move armor.py, races.py, weapons.py classes.py functions.py into a src/ folder.

Let me get it straight to you, your code is overall clean, well organized and documented, the advises will only make your code looks "more professional". If you want to be fancy you could also implement few pytest then set up Travis and codecov, you'll be able to brag with badges !

Congratulations for self-teaching yourself python !

More on reddit.com
🌐 r/learnpython
27
68
September 26, 2017
Python script to auto generate PDF Character sheets from "Fifth Edition Character Sheet"
Thanks! I use that app all the time and this is just what I needed :) More on reddit.com
🌐 r/dndnext
16
24
October 10, 2017
🌐
Instructables
instructables.com › living › toys & games
Create a DnD Character With Python3 : 4 Steps - Instructables
December 10, 2021 - Create a DnD Character With Python3: A new player in your group and he/she has no character ? Usually it would take you 15 minutes to create one but now, with a simple click you can do it ! First you need to have Python3 on your computer. If you don't, just go to https://www.python.or…
🌐
PyPI
pypi.org › project › dungeonsheets
dungeonsheets · PyPI
A tool to create character sheets and session notes for Dungeons and Dragons 5th edition (D&D 5e). Documentation can be found on readthedocs. ... Dungeon sheets requires at least python 3.6. This is mostly due to the liberal use of f-strings.
      » pip install dungeonsheets
    
Published   Nov 09, 2023
Version   0.19.0
🌐
StatusCake
statuscake.com › home › creating a d&d character in python
Creating a D&D character in Python - StatusCake Blog
March 2, 2022 - Never used Python before, or interested in how to make a D&D character using it? Read our dev guide on how to do just that!
🌐
GitHub
github.com › michaelplews › DnD-character-sheets
GitHub - michaelplews/DnD-character-sheets: LaTeX class for DnD character sheets
Character sheets can be built from .py files using the dungeonsheets tool. Install dungeonsheets from the python package index, and run makesheets to build the PDF character sheet. $ pip install dungeonsheets $ cd DnD-character-sheets $ makesheets
Starred by 33 users
Forked by 5 users
Languages   Python 70.7% | TeX 29.3% | Python 70.7% | TeX 29.3%
🌐
GitHub
github.com › AdrianDAlessandro › dnd5e-python
GitHub - AdrianDAlessandro/dnd5e-python: A repository of a python-based interactive character sheet
A repository of a python-based interactive character sheet for Dungeons & Dragons 5th Edition. Currently a jupyter notebook for scripting ideas and a module with some unit tests. Using pytest for the unit tests, there is a Dockerfile that can ...
Author   AdrianDAlessandro
Find elsewhere
🌐
YouTube
youtube.com › watch
Preview] Easily Create DND Character Sheets with Python! ...
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
OneCompiler
onecompiler.com › python › 3x2z8wwhm
dnd character generator - Python - OneCompiler
Following is a sample python program which takes name as input and print your name with hello.
🌐
GitHub
github.com › dougthor42 › DnD
GitHub - dougthor42/DnD: Attempt at making a DnD Character Sheet in Python.
Attempt at making a DnD Character Sheet in Python. - dougthor42/DnD
Author   dougthor42
🌐
Google
sites.google.com › pratt.edu › dndpcgenerator
D&D PC Generator
This project consists of 7 Python scripts, each of which takes steps to build different aspects of the character. In order, here are the steps taken to create a playable character: Select a race at random (and a sub-race, if applicable).
🌐
GitHub
github.com › sabrunel › dnd-character-generator
GitHub - sabrunel/dnd-character-generator: A pixel art D&D character generator built with Python and Tkinter
A pixel art D&D character generator built with Python and Tkinter - sabrunel/dnd-character-generator
Author   sabrunel
🌐
GitHub
github.com › tassaron › dnd-character
GitHub - tassaron/dnd-character: library for making Dungeons & Dragons 5e characters as serializable data · GitHub
You can use this library as a CLI tool to generate character sheets from the terminal; see python -m dnd_character --help for details.
Starred by 56 users
Forked by 23 users
Languages   Python
🌐
I Am Peel projects
iampeel.hashnode.dev › dd-35-character-sheet-in-python
D&D 3.5 Character Sheet in Python - I Am Peel projects
February 23, 2023 - I have been rolling this idea around my head for the past few months and I've finally decided to go through with it. I am going to attempt to build a Dungeons and Dragons v3.5 edition Character Sheet app for mobile systems using Python with the Kivy GUI library.
🌐
GitHub
github.com › topics › dnd
dnd · GitHub Topics · GitHub
May 31, 2018 - Python · Star 33 · LaTeX class for DnD character sheets · dnd dungeons-and-dragons character-sheet latex-class · Updated · May 7, 2021 · Python · Star 33 · PyDnD is a Dungeons and Dragons SRD Library for Python3 · python dnd dungeons-and-dragons srd dnd35 pydnd ·
🌐
GitHub
github.com › topics › character-sheet
character-sheet · GitHub Topics · GitHub
dungeons-and-dragons tabletop-gaming character-sheet roleplaying dnd4e dnd5e tabletop-rpgs dungeon-master d20 gurps fantasyflight wotc dnd35 motw ... An EXE and Python file to create your D&D character without dice nor handbook.