Commit 5ebb7f66 authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

Nice and clean ...

parent 4f329bc6
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -13,16 +13,11 @@
  </component>
  <component name="ChangeListManager">
    <list default="true" id="78671b20-6a1e-42c8-be28-50b7f38fa7ff" name="Default Changelist" comment="">
      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/Board.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/Board.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/Brain.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/Brain.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/LazyBrain.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/LazyBrain.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/SimpleBrain.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/SimpleBrain.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/SmarterBrain.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/Brain/SmarterBrain.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/highScores/highScore.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/highScores/highScore.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/CircleRolloverEvent.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/CircleRolloverEvent.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/CircleColor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/CircleColor.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/SelfAwareCircle.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/SelfAwareCircle.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/sge.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/sge.java" afterDir="false" />
      <change beforePath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/sge.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/SameGameTris.java" afterDir="false" />
    </list>
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -79,7 +74,7 @@
  </component>
  <component name="RunManager">
    <configuration name="EC504 SameGameTris" type="Application" factoryName="Application">
      <option name="MAIN_CLASS_NAME" value="edu.bu.ec504.spr24.sameGameTris.sge" />
      <option name="MAIN_CLASS_NAME" value="edu.bu.ec504.spr24.sameGameTris.SameGameTris" />
      <module name="sge_dist" />
      <method v="2">
        <option name="Make" enabled="true" />
@@ -100,7 +95,7 @@
      <workItem from="1548370619328" duration="375000" />
      <workItem from="1580056843261" duration="23542000" />
      <workItem from="1706041955741" duration="38000" />
      <workItem from="1706042051986" duration="6481000" />
      <workItem from="1706042051986" duration="6820000" />
    </task>
    <task id="LOCAL-00001" summary="Apparently working version.">
      <created>1580084914114</created>
@@ -147,7 +142,15 @@
      <option name="project" value="LOCAL" />
      <updated>1706049809584</updated>
    </task>
    <option name="localTasksCounter" value="7" />
    <task id="LOCAL-00007" summary="Nice and clean ...">
      <option name="closed" value="true" />
      <created>1706051180665</created>
      <option name="number" value="00007" />
      <option name="presentableId" value="LOCAL-00007" />
      <option name="project" value="LOCAL" />
      <updated>1706051180665</updated>
    </task>
    <option name="localTasksCounter" value="8" />
    <servers />
  </component>
  <component name="TypeScriptGeneratedFilesManager">
@@ -159,18 +162,19 @@
    <MESSAGE value="Minor tweaks" />
    <MESSAGE value="Cleaning up." />
    <MESSAGE value="Working version ..." />
    <option name="LAST_COMMIT_MESSAGE" value="Working version ..." />
    <MESSAGE value="Nice and clean ..." />
    <option name="LAST_COMMIT_MESSAGE" value="Nice and clean ..." />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager>
      <breakpoints>
        <line-breakpoint enabled="true" type="java-line">
          <url>file://$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/sge.java</url>
          <url>file://$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/SameGameTris.java</url>
          <line>658</line>
          <option name="timeStamp" value="1" />
        </line-breakpoint>
        <line-breakpoint enabled="true" type="java-line">
          <url>file://$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/sge.java</url>
          <url>file://$PROJECT_DIR$/src/edu/bu/ec504/spr24/sameGameTris/SameGameTris.java</url>
          <line>169</line>
          <option name="timeStamp" value="3" />
        </line-breakpoint>
+2 −2
Original line number Diff line number Diff line
package edu.bu.ec504.spr24.Brain;

import edu.bu.ec504.spr24.sameGameTris.CircleColor;
import edu.bu.ec504.spr24.sameGameTris.sge;
import edu.bu.ec504.spr24.sameGameTris.SameGameTris;
import java.util.LinkedList;
import java.util.Objects;

@@ -40,7 +40,7 @@ class Board {
   * default constructor
   */
  Board() {
    this(sge.getInstance().boardWidth(), sge.getInstance().boardHeight());
    this(SameGameTris.getInstance().boardWidth(), SameGameTris.getInstance().boardHeight());
  }

  /**
+2 −2
Original line number Diff line number Diff line
package edu.bu.ec504.spr24.Brain;

import edu.bu.ec504.spr24.sameGameTris.GUI;
import edu.bu.ec504.spr24.sameGameTris.sge;
import edu.bu.ec504.spr24.sameGameTris.SameGameTris;

/**
 * The Brain is the artificial intelligence that tries to come up with the
@@ -23,7 +23,7 @@ public abstract class Brain implements Runnable {
	/**
	 * Constructs the brain
	 */
	Brain() {this.myGUI = sge.getInstance();}
	Brain() {this.myGUI = SameGameTris.getInstance();}

	/**
	 * This is called when the Brain is being asked to close down (i.e., the game is over).
+4 −4
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ package edu.bu.ec504.spr24.sameGameTris;

import java.awt.Color;

import static edu.bu.ec504.spr24.sameGameTris.sge.randGen;
import static edu.bu.ec504.spr24.sameGameTris.SameGameTris.randGen;

/*
 * Records the color of one circle
@@ -32,11 +32,11 @@ public enum CircleColor {
	 * Generate a random color from the first num possible colors (excluding NONE)
	 */
	static CircleColor randColor() {
		if (sge.numColors < 1 || sge.numColors >= CircleColor.values().length)
		if (SameGameTris.numColors < 1 || SameGameTris.numColors >= CircleColor.values().length)
			throw new IndexOutOfBoundsException("Only " + CircleColor.values().length
					+ " colors are available.  You requested choosing one of " + sge.numColors + " colors.");
					+ " colors are available.  You requested choosing one of " + SameGameTris.numColors + " colors.");

		int randNum = 1 + Math.abs(randGen.nextInt()) % sge.numColors;
		int randNum = 1 + Math.abs(randGen.nextInt()) % SameGameTris.numColors;
		return CircleColor.values()[randNum];
	}
}
+8 −8
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ import static java.util.concurrent.Executors.newScheduledThreadPool;
 * A Singleton Graphical User Interface for the game.
 * @author Ari Trachtenberg
 */
public class sge extends GUI implements ActionListener, ItemListener {
public class SameGameTris extends GUI implements ActionListener, ItemListener {

  // CONSTANTS
  static public final int defaultWidth = 15, defaultHeight = 10; // sizes in terms of numbers of circles
@@ -62,7 +62,7 @@ public class sge extends GUI implements ActionListener, ItemListener {
  /**
   * An instance of the SGE GUI.
   */
  private static sge Instance = null;
  private static SameGameTris Instance = null;

  // ... GUI elements
  private JPanel circlePanel; // the panel containing the circles
@@ -147,7 +147,7 @@ public class sge extends GUI implements ActionListener, ItemListener {
  /*
   * Default no-args constructor
   */
  private sge() {
  private SameGameTris() {
    super("Ari's samegame");
  }

@@ -164,11 +164,11 @@ public class sge extends GUI implements ActionListener, ItemListener {
    }
  }

  public static sge getInstance() {
    if (sge.Instance == null) {
  public static SameGameTris getInstance() {
    if (SameGameTris.Instance == null) {
      // no Instance has been set up yet ... make it happen.
      sge.Instance = new sge();
      sge.Instance.run();
      SameGameTris.Instance = new SameGameTris();
      SameGameTris.Instance.run();
    }
    return Instance;
  }
@@ -656,7 +656,7 @@ public class sge extends GUI implements ActionListener, ItemListener {
   * Runs the application
   */
  public static void main(String[] args) {
    JFrame myApp = sge.getInstance();
    JFrame myApp = SameGameTris.getInstance();
    myApp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    myApp.setSize(defaultWindowWidth, defaultWindowHeight);
    myApp.setVisible(true);
Loading