Simulate a Monopoly game to generate the probabilities of landing on each square.

Overview

Monopoly-Probabilities

Simulate a Monopoly game to generate the probabilities of landing on each square.

While this project originally was inspired by Stand-up Maths from YouTube, it kind of grew into a way for me to play around with how to best share a python project. I wanted to make it easy for someone who was not a developer/not familiar with the command line, to be able to run this. Over time, this led me down a rabbit hole that has culminated in the current version of this repository. I'd love to continue to expand on this and add other ways to package up a Python project. Each approach has its pros and cons, so it is interesting (and useful) to try them out.

More README coming soon... How to use this library - TO-DO Add on other build tools - TO-DO

Comments
  • Stop using setup.py

    Stop using setup.py

    It seems that using setup.py is deprecated in favor of using either setup.cfg or pyproject.toml. As of PEP 621 you can store your project metadata in pyproject.toml, since I am basically already doing that I don't see why I shouldn't more formally use it.

    I do think I would need to keep using setup.py to build the C extension, but everything else can be moved to pyproject.toml. This should eliminate having to keep both files up to date with each other, which I already forgot about once.

    This does bring about an interesting situation. Poetry does not currently support PEP 621, so while it stores metadata in pyproject.toml, it does not yet support storing the project metadata there, in the standardized way. This isn't a total dealbreaker, as I could just manually add the info needed. But I also could migrate to something like PDM.

    There are a few thoughts I have regarding what tool to use:

    1. For a build backend, I'm going to have to use setuptools because I want to build a C extension. So even if I were to use Poetry's build backend, I would still also need setuptools...so I don't see a strong argument against simply using setuptools.
    2. For a frontend, I really like having pip in the scripts (scriptopoly and install). It is very integral in the script commands and I think for what it does, nothing more than pip is needed (and I suppose setuptools as well) Plus, it is basically included for free when setting up the virtual environment. I like having something more featureful while developing so I can have a better tool for setting up and managing dependencies. Poetry works great here, but moving forward, if it doesn't incorporate PEP 621, I would have to manually do that myself. The whole point of this is to simplify and use the approach that is going to be supported moving forward. It would seem to me I'd only be accomplishing the latter, and not even totally, with Poetry (for the time being, until it does add support for PEP 621).
    3. This is where PDM comes into play. It does dependency management like Poetry and Pipenv, but it is also PEP 621 compliant. I know I came across it a while back when it was relatively new. Now it seems to have grown and looks like it would be nice to work with. I'm kind of interested in using it just to see how it compares. Virtual Environments are also optional with that, it lets you use a different approach to dependency isolation if desired. I wouldn't need that, but it does seem interesting.

    So to sum up, for a build backend, just stick with setuptools since I have a C extension. For the frontend stick with pip in the scripts and switch to PDM for development so I can fully migrate to using pyproject.toml for storing the project metadata and dependencies in the Python blessed way. 🙏

    opened by dunkmann00 3
  • Produce a bar chart with the simulation's results

    Produce a bar chart with the simulation's results

    This will produce a bar chart with the results of the simulation. The chart is always produced as an svg image and is produced as a png image for everything except the PyOxidizer binary. There were just too many issues with getting it to work on that so it just isn't going to happen.

    opened by dunkmann00 2
  • Improve handling of Keyboard Interrupts

    Improve handling of Keyboard Interrupts

    This improves handling of keyboard interrupts in the C extension by explicitly checking for any queued signals. It also changes the text output to indicate the simulation was cancelled.

    opened by dunkmann00 1
  • Always make BUILD_DISTPATH a posix path

    Always make BUILD_DISTPATH a posix path

    After action-gh-release was updated globs are handled differently. This is because the glob library it uses was updated. The updated glob library always interprets backslashes as escape characters. This means if BUILD_DISTPATH has backslashes in it, action-gh-release won't match it correctly and won't upload our archives. To fix this, we can make sure to always use a posix path.

    opened by dunkmann00 1
  • Add code signing & notarization to GitHub Actions macOS build

    Add code signing & notarization to GitHub Actions macOS build

    This adds code signing and notarization to the Github Actions release workflow for macOS builds. This required a few changes to script.py as well. The actual signing is all handled in the script, while adding the certificate and notarization are handled in the release workflow.

    Closes #33

    opened by dunkmann00 1
  • Get Nuitka working on Windows

    Get Nuitka working on Windows

    With this pull request the Nuitka built binary builds on Windows, woohoo!

    There were two problems:

    1. The output filename needed to have the .exe extension.
    2. The directories for the output file path needed to exist.

    The other changes in this pull request are related to upgrading the version of Nuitka

    opened by dunkmann00 1
  • Improve status indicator on Windows

    Improve status indicator on Windows

    This improves the status indicator on Windows by using a custom class to handle rendering. Using rich created a blinking effect across the whole line while the bouncing bars appeared to skip quite a lot. Not very nice looking. This takes a different approach and brings back much of the old Spinner code, while updating it to only handle Windows, and also using the internals of rich to still create nice looking styles.

    opened by dunkmann00 0
  • Setup GitHub Pages

    Setup GitHub Pages

    Only include the README.md and title-image.png in the site build. For now, all settings can just be configured with the default ones GH pages uses when there is no config.

    This was working fine, until it stopped actually building the README.md and now the css is not getting loaded...I think I may merge this and see what happens.

    opened by dunkmann00 0
  • Fix Keyboard Interrupts Windows

    Fix Keyboard Interrupts Windows

    It seems that even though I had gotten the keyboard interrupts working on macOS, they still didn't want to work on Windows when ran in multi-core mode. This change fixes that problem by switching to starmap_async and then manually looping and sleeping until it is ready. This seems to give the interrupts a chance to be processed on Windows while also not adding a performance penalty.

    I also tested this on my Mac and the same was true. I won't bother adding a conditional check to only do it this way on Windows since it seems to not have any negative effects on macOS.

    opened by dunkmann00 0
  • Revert

    Revert "Let PyOxidizer handle multiprocessing on its own"

    Reverts dunkmann00/Monopoly-Probabilities#50

    After giving this a test on Windows (which I should have done before merging...) this still doesn't work. Reverting for now.

    opened by dunkmann00 0
  • Add 'Rich' text to monopoly's text output

    Add 'Rich' text to monopoly's text output

    This adds the Rich package to get nicer looking text output in the terminal. Rich also comes with a spinner so the Spinner from utils is no longer needed.

    This also required adding a hash to PyGal's requirements-runtime.txt entry because of how pip handles hashes. If one requirement has it, they all must. In the process of doing this I ended up building a wheel of the PyGal patch so that is what is now used to install PyGal. In the end, this is probably an improvement.

    Closes #43

    opened by dunkmann00 0
  • Enhancement: Add visual output from running simulation

    Enhancement: Add visual output from running simulation

    Currently a text and csv file are produced as results from the simulation. I would like to add a visual output like a bar graph and maybe an image of a heat-map over a basic version of the board outline.

    • [X] Bar Chart (#42)
    • [ ] Board Heat Map
    opened by dunkmann00 0
  • Nuitka binary doesn't work with multiprocessing

    Nuitka binary doesn't work with multiprocessing

    Not sure exactly why this is, but when I try to run the Nuitka binary with multiple cores using multiprocessing it doesn't work. When built in onefile mode it just dies after you try to run it. With standalone mode it sometimes spits out a segmentation fault, and other times it seems to run but error at the end with the following:

    /resource_tracker.py:96: UserWarning: resource_tracker: process died unexpectedly, relaunching.  Some resources might leak.
    

    So for now I have just disabled multi-core support for the Nuitka build.

    If a user wants to try multi-core mode despite the current problems, they can set the environment variable FORCE_NUITKA_MULTI when running monopoly and it will force it to run in multi-core mode.

    opened by dunkmann00 0
Releases(0.3.0)
  • 0.3.0(Dec 3, 2022)

    What's Changed

    • Update readme by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/36
    • Add code signing & notarization to GitHub Actions macOS build by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/35
    • Script work by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/38
    • Upload binaries as artifacts by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/39
    • Always make BUILD_DISTPATH a posix path by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/40
    • Produce a bar chart with the simulation's results by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/42
    • Refactor saving results code by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/44
    • Remove cairosvg, don't render pngs by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/45
    • Improving dependency managament by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/46
    • Add 'Rich' text to monopoly's text output by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/48
    • Downgrade PyOxidizer by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/49
    • Let PyOxidizer handle multiprocessing on its own by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/50
    • Add title-image to README by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/51
    • Bump to 0.3.0 by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/52
    • Revert "Let PyOxidizer handle multiprocessing on its own" by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/53

    Full Changelog: https://github.com/dunkmann00/Monopoly-Probabilities/compare/0.2.0...0.3.0

    Source code(tar.gz)
    Source code(zip)
    monopoly-0.3.0-linux-x86_64.tar.gz(66.55 MB)
    monopoly-0.3.0-macosx-10.15-x86_64.tar.gz(39.56 MB)
    monopoly-0.3.0-win-amd64.zip(38.11 MB)
  • 0.2.0(Oct 28, 2022)

    Initial release of Monopoly Probabilities. This release includes the binaries to run the simulation on Mac, Windows, & Linux. The binaries included are built with PyInstaller, PyOxidizer, and Nuitka.

    What's Changed

    • Use python for script file by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/2
    • Improve build system by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/3
    • Fix pyoxidizer multiprocessing on Windows by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/4
    • Get Nuitka working on Windows by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/5
    • Add .so and .pyd files to BUILD_ARTIFACTS by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/6
    • Fix scriptopoly command by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/8
    • Bump dependencies by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/9
    • Have subprocess output string instead of bytes by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/10
    • Add release.yml GH action by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/11
    • Fix release.yml errors by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/12 https://github.com/dunkmann00/Monopoly-Probabilities/pull/13 https://github.com/dunkmann00/Monopoly-Probabilities/pull/14 https://github.com/dunkmann00/Monopoly-Probabilities/pull/15 https://github.com/dunkmann00/Monopoly-Probabilities/pull/16 https://github.com/dunkmann00/Monopoly-Probabilities/pull/17 https://github.com/dunkmann00/Monopoly-Probabilities/pull/18 https://github.com/dunkmann00/Monopoly-Probabilities/pull/19 https://github.com/dunkmann00/Monopoly-Probabilities/pull/20 https://github.com/dunkmann00/Monopoly-Probabilities/pull/21 https://github.com/dunkmann00/Monopoly-Probabilities/pull/22 https://github.com/dunkmann00/Monopoly-Probabilities/pull/23 https://github.com/dunkmann00/Monopoly-Probabilities/pull/24 https://github.com/dunkmann00/Monopoly-Probabilities/pull/25 https://github.com/dunkmann00/Monopoly-Probabilities/pull/26 https://github.com/dunkmann00/Monopoly-Probabilities/pull/29 (If there is a better way to debug this I would love to hear about it...)
    • Add archive-binaries command to script by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/27
    • Use simple tag name in BUILD_DISTPATH by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/28
    • Add to requirements-binaries.txt by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/30
    • Bump project version by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/31
    • Fix distpath handling with PyInstaller by @dunkmann00 in https://github.com/dunkmann00/Monopoly-Probabilities/pull/32

    New Contributors

    • @dunkmann00 made their first contribution in https://github.com/dunkmann00/Monopoly-Probabilities/pull/2

    Full Changelog: https://github.com/dunkmann00/Monopoly-Probabilities/commits/0.2.0

    Source code(tar.gz)
    Source code(zip)
    monopoly-0.2.0-linux-x86_64.tar.gz(58.05 MB)
    monopoly-0.2.0-macosx-10.15-x86_64.tar.gz(30.39 MB)
    monopoly-0.2.0-win-amd64.zip(30.74 MB)
Owner
George Waters
George Waters
Racers-API - a game where you have to go around racing with your car, earning money

Racers-API About Racers API is a game where you have to go around racing with yo

3 Jan 09, 2022
A small game I made back in think 2011

Navi Network A small game I made back in think 2011. An online game inspired by the self-hosted nature of Minecraft, made with pygame, based on the Me

Peder Bergebakken Sundt 2 Jan 19, 2022
Simple program to play Metamon automatically

Getting Started Radio Caca Important disclaimer This software is intended for use by individuals familiar with Python programming language. It uses se

Metamon Island 35 Dec 28, 2022
2D Minecraft Clone made with Python & Pygame & OpenGL

2D Minecraft Clone This is a 2D clone of the well-known game Minecraft made in Python using Pygame and ModernGL I started this mostly as a self-improv

Kadir Aksoy 2 Sep 25, 2022
A Python Sudoku Game Made with Pygame.

A Python Sudoku Game Made with Pygame. A Begginer Aimed at Learning Git, This Game Uses a Puzzle Generator Made by RutledgePaulV, Link to his Repo:

helaxious 3 Jun 29, 2022
Utility for generating randomizer datapacks for minecraft.

Minecraft Rando Utility for generating randomizer datapacks for minecraft. At the moment, it randomizes the following: Loot tables (including block dr

2 Dec 02, 2021
Yo-Snake - A blend of yolov5 and deepsnake

Yo-Snake A blend of yolov5 and deepsnake 结合了yolov5和Deepsnake模型 Deepsnake 模型代码比较复

7 Apr 01, 2022
An interactive pygame implementation of quadtree spatial quantization

QuadTree-py An interactive pygame implementation of quadtree spatial quantization Contents Installation Usage API Reference TODO Installation Clone th

Ethan 1 Dec 05, 2021
Code d'un jeu en python par Graveen (avec mes modifications)

ATTENTION Vous ne devez pas copier coller le code sans le comprendre, apprennez déjà, le python et pygame, et seulement ensuite, vous pourrrez l'utili

TheBigWolfy 7 Nov 02, 2022
The original Tetris tile-matching game as adopted by IBM PC.

🕹️ Tetris Game The original Tetris tile-matching game as adopted by IBM PC. Game developed purely on python using the Dear PyGui Framework. 📖 Instru

14 Nov 12, 2022
A sprite ripper and converter for Com2uS' 2007 game Music World.

Music World Sprite Dumper This repository contains a python script reads an UNCOMPRESSED Music World pxo file and attempts to dump sprites from it. Th

Buu342 1 Mar 16, 2022
This is a two player snake game

Trake This is a two player snake game How to play the game There is food and two players. You try to eat food to become large and gain points. Player

Grrub 1 Dec 19, 2021
PYGA: Python Google Analytics (ga.js) - Data Collection API

PYGA: Python Google Analytics - Data Collection API pyga is an implementation of Google Analytics (ga.js) in Python; so that it can be used at server

Arun Karunagath 136 Sep 19, 2022
Algorithm to solve Wordle correctly 100% of the time within 6 attempts.

WordleSolver © Zulkarnine, 2022. Algorithm to solve Wordle 100% of the time within 6 attempts. You can go ahead and run main.py to run it for all 2315

Zulkarnine Mahmud 69 Dec 11, 2022
Orbital-patterns - A program which plots pattern that revolving planets make

orbital-patterns Click to spawn planets Press "S" to capture screenshot. Image w

Yuvraj.M 11 Dec 24, 2022
Blackjack Game made using Python

Blackjack Game made using Python Blackjack is a popular card game played in most of the casino.This is an intuition to replicate the same card game us

SUHASJAGADISH 1 Nov 28, 2021
Quiz Game: answering questions naturally with a friendly UI to enjoy the game

About Quiz Game : The Game is about answering questions naturally with a friendl

4 Jan 19, 2022
A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

A minimal open source mtg-like tcg game made in python that can be played on a terminal emulator using a keyboard.

Amos 3 Aug 29, 2021
A python-based multi-player online educational game for students to play in a class or club setting.

Kurono (codename: aimmo) Code for Life has been developed by Ocado Technology as a free, open-source project to inspire the next generation of compute

Ocado Technology 108 Nov 07, 2022
An easy to use game engine/framework for python.

A game engine powered by python and panda3d.

Petter Amland 1.6k Jan 05, 2023