Originally Posted by
JavaPF
Sure you can see the Connect4Class. I've attached my code on the following link, as I don't know how to put the code within the tags.
Java | public class Connect4Column { - Anonymous - 1A1PadCq - Pastebin.com
public class Connect4Column
{
private int counters[];
private int numCounters;
private int MAX_NUM_COUNTERS;
static int YELLOW_COUNTER = 1;
static int RED_COUNTER = 2;
public Connect4Column(int max_counters)
{
MAX_NUM_COUNTERS = max_counters;
counters = new int[MAX_NUM_COUNTERS];
numCounters = 0;
}
public boolean addCounter(int thisCounter)
{
if ((numCounters < MAX_NUM_COUNTERS)&&((thisCounter == 1)||(thisCounter == 2)))
{
counters[numCounters] = thisCounter;
numCounters++;
return true;
}
else
{
return false;
}
}
public int getNumCounters()
{
return numCounters;
}
public int getCounter(int thisRow)
{
if ((thisRow >= 0)&&(thisRow <= numCounters))
{
return counters[thisRow];
}
else
{
return 0;
}
}
}
I don't know if this is the correct way of putting the code into the CODE tags. But the link is also avaliable