Pawel Pawlowicz wrote:Welcome!
What is your question? What can we help you with? We won't write the code for you (NotACodeMill <- click).
And thank you for using code tags in your first post
Stephan van Hulst wrote:Okay, so it all boils down to creating 5 classes: Board, GreedyPlayer, AdjacentGemPolicy, WholeRowColGemPolicy, and ChainedGemPolicy.
Let's start with one.
I made a few tiny changes: Board is now final and implements Cloneable. If you're going to give clone() an implementation, the class should probably be Cloneable. Also, clearFlags and doRemovals are now package private (they don't have the public access specifier). The reason is that these methods should only be used by the Game class, and not by the public at large.
Now, don't start adding fields blindly. You really don't need an int array if you already have a Gem array to keep track of the data for you. You also don't need an int rows or an int cols, because these can be found by the size of gems.
So! Let's start with the rows() and cols() methods. If you have a Gem, how would you implement these?
" Any gem flagged (see method Gem.flagged()) for removal will be removed. Blocks that should "fall" will do so now, and colums that should shift left will also do so now. "
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton