Presentation is loading. Please wait.

Presentation is loading. Please wait.

Date Submission: January 29, 2011 Submitted by: Syeda Khushbakth Rizvi Syed Hasan Asghar Submitted to: Ms. Quratul-Ain Nizam-ud-din Rajput DATA STRUCTURES.

Similar presentations


Presentation on theme: "Date Submission: January 29, 2011 Submitted by: Syeda Khushbakth Rizvi Syed Hasan Asghar Submitted to: Ms. Quratul-Ain Nizam-ud-din Rajput DATA STRUCTURES."— Presentation transcript:

1 Date Submission: January 29, 2011 Submitted by: Syeda Khushbakth Rizvi Syed Hasan Asghar Submitted to: Ms. Quratul-Ain Nizam-ud-din Rajput DATA STRUCTURES AND ALGORITHMS CSE - 246 FALL 2010 – BS-III TERM PROJECT - MONOPOLY

2 INTRODUCTION: Monopoly is a board game published by Parker Brothers, a subsidiary of Hasbro. The game is named after the economic concept of monopoly, the domination of a market by a single entity. The Monopoly game board consists of forty spaces containing twenty- eight properties (twenty-two colored streets, four railroads and two utilities), three Chance spaces, three Community Chest spaces, a Luxury Tax space, an Income Tax space, and the four corner squares: GO, Jail, Free Parking, and Go to Jail.

3 GOALS AND LEARNING: Goal of the game: Is to bankrupt the opponent as soon as possible, via rents and mortgage. Goal of the project: To use the data structures learned during the course and implement them efficiently. To make use of techniques of GUI. To create a two player game, played against bot.

4 SCOPE AND LIMITATIONS: SCOPE: The game makes use of three operations only, out of many which are originally used: Buy, rent and pay taxes. LIMITATIONS: The game doesn’t have an ending message, as it is logically deduced that when the opponents cash is finished or have a negative balance the counter-part wins. There are no houses in estates and rents are doubled when all the properties of a particular color is monopolized. Mortgages are not included in the game operations. Banks are not included either.

5 PROGRAMMING TOOLS: o Data structures : Arrays o Built-in class: AWT 1.Action Listener 2.Action Event 3.Buffered Image Swing 1.Button 2.Panel 3.Label 4.Frame o Text tool

6 ALGORITHM: In start, human plays first. On click of dice roll, piece will move. Roll dice uses random number generator. Movement is done by Cartesian coordinate system. For each estate, either estate can be rented or bought when clicked on buy. When clicked on done the turn ends. Similarly, Bot will play. Options are available for the players if they want to buy an estate or pay rent and move on. These messages are displayed in the frames and labels. The estates on the game board are pictures, whose particulars are saved in arrays’ index. When a particular piece lands on a estate, that particular array index is retrieved, and its elements manipulated. If you get on community chest or chance, changes in the money or location will come about accordingly. If you get in jail, 50 units of money is detected and the location is reverted 20 places.. If the money is not available, the game ends.

7 ALGORITHM: CONTD.. The money is deduced according to the choices made by the player. This also depends on the chance cards and community chest cards which are awarded randomly. Rents are added or deducted on the next dice roll. If a player’s money is finished, they lose.

8 INTERFACE: Nine classes are made to implement the game efficiently. Public class Chancearray{} Public class communitychestarray{} Public class Estates{} Public class Monopoly{} Public class Player{} Public class whichplayer{} Public class Boardestate{} Public class cardsobject{}

9 METHODS IMPLEMENTED: public static void fillimagearray() public Monopoly() // handles GUI operations public void paint(Graphics g) // marks bought estates public void draw(Graphics g) throws InterruptedException // makes images of estates on the game board public static int move() // move human’s piece public static int move1() // moves bot’s piece public static int injail(int x, Player p) // calculate jail penalty public int checklast(int location, Player p) // gets last position of piece public static void checkwin(Player p,Player ip) throws InterruptedException // checks if a player is winning yet

10 METHODS IMPLEMENTED: CONTD.. public static void checkestate(int move, Player p) // see if estate is available public static boolean checklabel(int x) public static void humanmove() throws InterruptedException public static void computermove() throws InterruptedException public static void gettingchance(Player p) // gives chance card public static void gettingcommunitychest(Player p) // gives community card public static void main(String args[]) throws Exception public void setxy() // initialize coordinates Public int getx(int x) // retrieves value of x coordinate Public int gety(int x) // retrieves value of y coordinate public Player(int p,String n)

11 METHODS IMPLEMENTED: CONTD.. public Estates() public void setcc() public void getcc(int x, Player p) public communitychestarray() public void setchance() public void getchance(int x,Player p) public Chancearray() public cardsobject() public void setvalue() public Boardestate()

12

13

14

15

16


Download ppt "Date Submission: January 29, 2011 Submitted by: Syeda Khushbakth Rizvi Syed Hasan Asghar Submitted to: Ms. Quratul-Ain Nizam-ud-din Rajput DATA STRUCTURES."

Similar presentations


Ads by Google