import java.io.IOException; public class Execute { static String buf = new String(); static boolean new_play; static void execute(int com_num) { new_play = false; Invoker.invoke(Monop.func[com_num]); Misc.notify1(); Mortgage.force_morg(); if (new_play) { Misc.next_play(); } else if (Monop.num_doub != 0) { System.out.println(Monop.cur_p.name + " rolled doubles. Goes again"); } } public static void do_move() { int r1 = 0; int r2 = 0; boolean was_jail = false; new_play = was_jail; System.out.println("roll is " + (r1 = Roll.roll(1, 6)) + ", " + (r2 = Roll.roll(1, 6))); if (Monop.cur_p.loc == Monop.JAIL) { was_jail = true; if ( ! Jail.move_jail(r1, r2)) { new_play = true; return; } } else { if (r1 == r2 &&++Monop.num_doub == 3) { System.out.println("That's 3 doubles. You go to jail"); SpecialMoves.goto_jail(); new_play = true; return; } move(r1 + r2); } if (r1 != r2 || was_jail) { new_play = true; } return; } static void move(int rl) { int old_loc = Monop.cur_p.loc; Monop.cur_p.loc = (Monop.cur_p.loc + rl) % Monop.N_SQRS; if (Monop.cur_p.loc < old_loc && rl > 0) { Monop.cur_p.money += 200; System.out.println("You pass " + (Monop.board[0].name) + " and get $200"); } show_move(); } static void show_move() { Sqr_st sqp = Monop.board[Monop.cur_p.loc]; System.out.println("That puts you on " + sqp.name); switch (sqp.type) { case Monop.SAFE: System.out.println("That is a safe place"); break; case Monop.CC: SpecialMoves.cc(); break; case Monop.CHANCE: SpecialMoves.chance(); break; case Monop.INC_TAX: SpecialMoves.inc_tax(); break; case Monop.GOTO_J: SpecialMoves.goto_jail(); break; case Monop.LUX_TAX: SpecialMoves.lux_tax(); break; case Monop.PRPTY: case Monop.RR: case Monop.UTIL: if (sqp.owner < 0) { System.out.println("That would cost $" + sqp.cost); if (Misc.getyn("Do you want to buy? ") == 0) { PropertyFunctions.buy(Monop.player, sqp); Monop.cur_p.money -= sqp.cost; } else if (Monop.num_play > 2) { PropertyFunctions.bid(); } } else if (sqp.owner == Monop.player) { System.out.println("You own it."); } else { Rent.rent(sqp); } } } public static void save() { } public static void restore() { String sp = null; System.out.print("Which file do you wish to restore from? "); try { buf = CIOUtils.stdin.readLine(); } catch (IOException e) { System.err.println("IO Exception:" + e); } sp = ""; rest_f(buf); } static boolean rest_f(String file) { return true; } }