Code Monkey home page Code Monkey logo

monopoly's People

Contributors

sanjaythomas avatar varun93 avatar

Watchers

 avatar  avatar

monopoly's Issues

Use random instead of numpy to roll dice

In dice.py, you use numpy to roll the dice like so:
roll = np.random.choice(np.arange(1, 7), 2)
This causes a number of problems. For example, the player money can change type from int to numpy.int32 (since the roll is used to calculate utility payment), which causes a comparison like money > 0 to return a numpy.bool, which causes the return value of buyProperty (for example) to no longer be of type bool, which makes it default to False (which had me questioning my sanity). You could replace the line with:
roll = [random.randint(1, 6), random.randint(0, 6)]
to solve these issues.

Player 2 wins when making payment greater than its money

When player 2 lands on a space and doesn't have enough money to pay its debt, it wins the game. I suspect this is due to the following code in adjudicator.py:

if not result[0]:
    winner = opponent.id
    break
elif not result[1]:
    winner = currentPlayer.id
    break

Since the handle_payment method returns the same thing no matter whose turn it is, this produces the incorrect result.

Phase information(6th index in State) for TRADE is not as per the Documentation

Whenever Trades are proposed, the additional information field is supposed to have 5 elements i.e
True/False, Cash offered, Properties offered, Cash Requested, Properties requested.
But below are the issues found in it:

  • Agent 1 : the STATE passed to 'RespondTrade' function does not contain the 'True/False' value, it just has the other 4 elements
    example - (75, [], 0, [12])

  • Agent 2 : 'RespondTrade' is called twice by the adjudicator and in the 1st call 'True/False' is not present but in the 2nd call, all 5 elements are present.
    example - (75, [], 0, [12]), (False, 75, [], 0, [12])

timeout decorator issue in windows environment

hi could you please tell me if there is any environment requirements for the adjudicator.
I was facing this issue in windows environment looks like signals are not supported in windows environment.
Traceback (most recent call last):
File "testcases.py", line 1535, in
test(adjudicator)
File "testcases.py", line 101, in testcase_auction
[winner,final_state] = adjudicator.runGame(agentOne,agentTwo,[[3,5]],None,None)
File "D:\final sem\dsf\dsf_project\dsf-project\adjudicator.py", line 1356, in runGame
self.conductBSTM(self.state)
File "D:\final sem\dsf\dsf_project\dsf-project\adjudicator.py", line 534, in conductBSTM
bstmActionAgentOne = self.runPlayerOnStateWithTimeout(self.agentOne,state)
File "C:\Users\MOHANGANDHI\AppData\Local\Programs\Python\Python37-32\lib\site-packages\timeout_decorator\timeout_decorator.py", line 78, in new_function
old = signal.signal(signal.SIGALRM, handler)
AttributeError: module 'signal' has no attribute 'SIGALRM'

Reset double_counter

self.double_counter += self.double

we were trying to understand double_counter logic.It looks like double_counter is not reset to zero and so non consecutive doubles are also getting tracked.Are we missing something?

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.