So I was sitting in my house today and was thinking about how long its been since I last played Monopoly and started to get the itch to play. As I was searching online to find some Monopoly game to download I though about what a great idea it would be to write my own. So I have spent a few hours today and though I would share my progress. Also since silabsoft.org is my homepage I hoped this post would motivate me to continue working on it
The Dice Class:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.silabsoft.jmonopoly.model; import java.awt.Image; import java.awt.image.BufferedImage; import java.util.Comparator; import java.util.Random; /** * * @author Silabsoft */ public class Dice extends BoardEntity { private final BufferedImage[] diceImages; private final Random random = new Random(); private int value; public static int t; public Dice(int x, int y, BufferedImage diceImages[]) { drawX = x; drawY = y; this.diceImages = diceImages; rollDice(); } public Image getImage() { return diceImages[value - 1]; } public void rollDice() { value = 1 + random.nextInt(6); } public int getValue() { return value; } public static boolean isDouble(Dice a, Dice b) { return a.getValue() == b.getValue(); } public boolean isDouble(Dice compare) { return this.getValue() == compare.getValue(); } public int getTotal(Dice dice) { return this.getValue() + dice.getValue(); } public static int getTotal(Dice a, Dice b) { return a.getValue() + b.getValue(); } }

