Coder Social home page Coder Social logo

monopoly_java's Introduction

Monopoly Game Board

By: Yousef-Emadi
Idea by: Shoko84

The game is played on a circular game board. There are 40 positions on the board, indexed from 0 to 39.

BASIC RULES

Each player rolls two dice, and moves forward the sum of the dice rolled positions. Multiple players can occupy the same position. If a player reaches position 39 and still needs to move forward, he'll continue from position 0. In other words, positions 38, 39, 0, 1, 2 are contiguous. Unless something special happens (see below), his turn ends after moving.

DOUBLE RULES

A double refers to a roll where both dice have the same value. If the player rolls a double, then he rolls the dice and moves again. If the player rolls a double three times in a row, then he immediately goes to jail (see below) and his turn ends there.

JAIL RULES

The Visit Only / In Jail position has a dual nature: the player is either visiting only, or actually in jail, depending on how he got there.

If at the end of a basic move, the player lands on Go To Jail, then he immediately moves to the position Visit Only / In Jail and is in jail. His turn ends. If the player rolls a double for the third time in a single turn, then he immediately moves to the position Visit Only / In Jail and is in jail. His turn ends.

If after moving, the player lands on Visit Only / In Jail, he is visiting only and is not in jail.

While the player is in jail, he still rolls the dice on his turn as usual, but doesn't move until either: (a) he rolls a double, or (b) he fails to roll a double for three throws (i.e. his previous two turns after moving to jail and his current turn). If either (a) or (b) happens in the player's turn, then he moves forward the sum of the dice rolled positions and his turn ends. He doesn't roll the dice again even if he has rolled a double.

Note: Visit Only / In Jail is at position 10. Go To Jail is at position 30. Input Line 1: An integer P for the number of players Next P lines: One line for each player, containing the name and the initial position, separated with a space Next line: An integer D for the number of dice rolls in playing order Next D lines: One line for each dice roll (space-separated) Next 40 lines: One line for the name of each board position. Note that these aren't actually needed to solve the puzzle. Output P lines: One line for each player, containing the name and the latest position, separated with a space. The output should follow the same order of the players as given in the input. Constraints 2 ≤ P ≤ 6 Players' names do not contain any spaces. Players never start on Go To Jail or in jail. The game board is constant.

https://www.codingame.com/ide/puzzle/simplified-monopoly-turns-prediction

monopoly_java's People

Contributors

yousefemadi avatar

Watchers

 avatar

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.