1 Replies - 1492 Views - Last Post: 05 August 2010 - 11:02 PM Rate Topic: -----

#1 magnifik  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 31
  • Joined: 28-July 10

connect four modified

Posted 05 August 2010 - 10:15 PM

i'm trying to write a piece of code for removing a game piece from a connect four board. in this case, all the other pieces would move down to the last row. i used the code from the Connect Four Tutorial on this website and just changed the arithmetic operators to their opposites thinking that would make sense. i'm not sure what else i should change. any suggestions would be appreciated

int remove(int b, char player){
	if(b >=0 && b<= 6)
	{
		if(place[0][b] == 'R' || place[0][b] == 'B'){ // indicates that a piece is in that position
			int i;
			for(i = NUM_ROWS;place[i][b] == ' ';i--)
				if(i == 5)
                                {
                                  place[i][b] = player;
			          return i;
                                }
			i++;
			place[i][b] =player;
			return i;
			
		}
		else{
			return -1;
		}

	}
	else{
		return -1;
	}

}



This post has been edited by magnifik: 05 August 2010 - 10:16 PM


Is This A Good Question/Topic? 0
  • +

Replies To: connect four modified

#2 taylorc8  Icon User is offline

  • B&

Reputation: 149
  • View blog
  • Posts: 1,572
  • Joined: 21-July 09

Re: connect four modified

Posted 05 August 2010 - 11:02 PM

So... what have you tried so far? you just copied/pasted and can't fix it?

So... what have you tried so far? you just copied/pasted and can't fix it?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1