Giter Site home page Giter Site logo

gnome-p3's Introduction

MONOPOLY SIMULATOR

Full code for the Monopoly simulator is in GNOME-p3/monopoly-simulator/ and is written using OOP methodology.

The following steps have to be followed before running the simulator:

  • Install python3.
  • Clone the GNOME-p3 repository - $ git clone [email protected]:mayankkejriwal/GNOME-p3.git
  • All the python packages required to run a game instance can be installed using $ pip install -r requirements.txt (--user may be required for some systems).

Repository branches:

"master": The "master" branch of this repository works ONLY if Pycharm is installed. Pycharm is highly recommended to run the monopoly simulator and the instructions given below are to be followed only if running the simulator using Pycharm IDE.

"serial_com_over_socket": This branch can be used while developing a player agent not implemented in python to be plugged into the simulator. Information transfer happens via a server-client architecture over a socket. More information regarding this branch can be found in the README.md of that branch. To switch branch to "serial_com_over_socket" - $ git checkout serial_com_over_socket

"modified_imports": If Pycharm is NOT installed and the simulator can be run only on the terminal, then switch branch from "master" to "modified_imports" and follow the instructions given in that branch. To switch branch to "modified_imports" - $ git checkout modified_imports

To run an instance of the game:

Firstly, open GNOME-p3 repo as a project in Pycharm.

Following changes have to be made to file GNOME-p3/monopoly_simulator/gameplay.py before running a game instance:

  • Within the play_game() function, log folder path and log file path have to be specified for logging of game details in lines 370 and 375 respectively.
  • In lines 385 and 440, modify the default path to the game schema json file with the path where it is saved on your system (give complete path).
  • Uncomment the last line play_game() (line 476).
  • The game can then be run by running GNOME-p3/monopoly_simulator/gameplay.py file on the Pycharm IDE.
  • When Pycharm is installed, the game can also be run on the command line using the master branch. Open the command line at the GNOME-p3 project level and run the following command - $ python3 monopoly_simulator/gameplay.py

Other useful tips/features:

  • Logging of the game can be onto console and and into log file. This can be enabled/disabled in GNOME-p3/monopoly_simulator/logging_info.py file in line 22.
  • The seed defined in the simulate_game_instance() function argument ensures game replication (default seed is already set, pass in new seed in line 407 for a different game instance to be played out).
  • The simulator package comes with a few pre-implemented agents (agent implementation in files with names background_agent_v[x].py and baseline_agent.py). You are free to plug in any of the implemented agents into each player in lines 380-383 in GNOME-p3/monopoly-simulator/gameplay.py (default agents are set). The latest updated background agent is GNOME-p3/monopoly-simulator/background_agent_V3_1.py and the baseline agent is GNOME-p3/monopoly-simulator/baseline_agent.py.
  • (Optional) You can implement your own custom agent and replace any of the existing player agents with the new agent. In order to do so, all functions in the Agent class as specified in GNOME-p3/monopoly_simulator/agent.py has to be implemented and imported into GNOME-p3/monopoly_simulator/gameplay.py. (See existing agent implementations for reference.)
  • (Optional) The gameplay can also be viewed in 2D GUI by running GNOME-p3/monopoly_simulator/gameplay_GUI.py following the same instructions as above. The packages for the GUI can be installed using $ pip install -r requirements_GUI.txt.

gnome-p3's People

Contributors

minhsueh avatar shilpath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gnome-p3's Issues

ImportError on non-existent module "background_agent_v4" in gameplay.py

(venv) ~/GNOME-p3/monopoly_simulator% git rev-parse HEAD
fa0862e141bf1ddf2c30696b9330ff825c32be78
(venv) ~/GNOME-p3/monopoly_simulator% python gameplay.py
Traceback (most recent call last):
  File "gameplay.py", line 9, in <module>
    from monopoly_simulator import background_agent_v4
ImportError: cannot import name 'background_agent_v4'

The offending import is here:

from monopoly_simulator import background_agent_v4

Removing the offending important resolves the issue, but perhaps _v4 should be checked into git if it is the correct version.

Fix formatting of README.md to be a Markdown file

The existing README.md file is not formatted as a Markdown, including section titles and bullet points, and thus renders as one continuous flow of text that is hard to read, i.e.,

image

If README.md is converted to Markdown, then the result will be much more readable:

image

Add __init__.py file to the monopoly_simulator directory and clarify build

The existing monopoly_simulator directory is treated as a Python project, for example:

from monopoly_simulator import location
from monopoly_simulator.dice import Dice
from monopoly_simulator.bank import Bank

but it does not contain an __init__.py file that specifies the directory is a Python package.

In the absence of a top-level setup.py script and monopoly_simulator/__init__.py file, it is not evident how to correctly run this code either from first principles or from the README.md file. While certain work-around involving symlinks or running python -m might work, in my sandbox these turned out to be brittle and nonstandard solutions (even for research-ware!).

Specifically, the recommendation is:

  1. Create __init__.py in monopoly_simulator/ making it a Python package.
  2. Write a minimal setup.py script that builds the software so that it can be executed and imported like any Python package.
  3. Document the steps needed to build and run the package in the README.md so that new users can reliably build the system in a standard way.

Questions - How to run GUI/human agent/sim more games

I followed the README, and is able to run 1 simulated game w/o the GUI by running gameplay.py.
However, was wondering how do I

  1. See the game play via GUI
  2. Can we pit agents against human player?
  3. Can I simulate 100 games (not just 1)

ps. i have py 3.8 so had issues with Kivy and had to install this way: kivy/kivy#6563

rl_agent_background missing

@minhsueh Is there a reason you didn't check in 'rl_agent_background.py' as part of the 'phase3_simulator_v1' branch?

Furthermore, found this other repo wherein the step function does not match your reward description in the paper & let's the agent assign a reward to its own action which is plain wrong from a design perspective. Not to mention incentivizing skipping above other legal moves (+2 vs +1).

So, what's the deal? Did you fake your paper's results?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.