Task to Complete

Modify a previous program to use the Bridge Pattern.  This project must:

  • be a modification of a previous program
  • have at least two forms of implementation (i.e. text vs graphics)

Febraury 15th, 2017

  • I spent this class completing the sample Bridge Pattern code Dr. Delgado gave us.  It implemented a rectangle through both printing out its dimensions using text and displaying it using StdDraw on the screen.

February 17th, 2017

  • I decided to revisit the very first program in AI – Game of Life.  It is a relatively simple program and can be implemented using both graphics and text.
  • I spent this class setting up the program structure for the Bridge Pattern.  This included creating an Abstraction abstract class as well as an Implementor interface.
  • I also created a GameAbstraction class, extending Abstraction, to run the simulation, as well as TextGameImplementor and GraphicsGameImplementor classes, implementing Implementor, to display the simulation using text and graphics, respectively.
  • This structure is more complex than my normal programs are, so setting it up really required me to fully understand how Bridge Pattern works.

February 21st, 2017

  • Because I already had code for the Game of Life, I spent the first part of class today quickly copying the actual simulation from my old program into the GameAbstraction class.  Interestingly, I found that I had changed and improved a lot as a programmer over the last couple of months, so there were quite a bit of things that I had to “revamp” in the code.
  • I spent the rest of class filling in the GraphicsGameImplementor class.  Again, lots of the code from the original program was reused.  One of the notable changes made to the graphics code was the use of the “pack” method, which I had learned to use since the original Game of Life project to automatically adjust the size of the JFrame.

February 23rd, 2017

  • Today, I spent my time filling in the TextGameImplementor class.
  • Completing this part of the code was relatively simple.  Each time the simulation was updated, I would just have to print out all the living/dead cells on the console, represented by X’s and O’s.
  • However, to make this even better, I attempted to clear the console every time the simulation was printed, such that the changes would seem more continuous.
  • I didn’t know how to do this, so I had to search online for solutions.  However, none of those online worked for me.  I’m not sure why this is, but there are indications that it might be because my computer runs Windows 7, which does not have some of the Windows 10 console-clearing features.  So as of now, my text implementation is still using the original method.
  • If I had more time on this project, I would continue looking for ways to clear the console in order to improve the text implementation.