tifreak8x wrote:
So, I came up with the code to build the simple board type, I just have to get it put into the program and test that it will work. I will still need to add in code to remove the animation to place the coin on the next available line, and to use the Goose coin code to better fill in the circles.
Are you using some kind of rounding or flooring on your circles? That's the only thing I can think of that would be making them get oddly cut off like that. Glad to hear of your latest progress.
Well, the coins are still yours, the cut out holes are all Weregoose.

On a side note, changing between simple and default boards completed. Changing between animations on and off implemented via menu, however not implemented in game play.

Edit:



Oh, great call on the simplified board for faster rendering. This looks superb! What left for you to do tomorrow? Removing the animations in gameplay and fixing the circles?
Yes, those are the last 2 things I need to accomplish. And the nice thing about the menu you start out with (ref 1st animated screen) is that if I decide to add more to this later, I can just tuck it right there.

It's going to default to the fancy board, so if they don't change it, that's their issue, not mine. :p


So! Fast drop works! Found out I need to have it detect from the middles as well! SO! I am going to spend some time expanding the win detection. And then Weregoose can say oh hey, let's take that 1kb of code, and make it 3 lines! And I will walk away in shame. Wink lol

Anyways, on to making the circles prettier.

Edit:



Circles are now the same as the ones 'cut' out of the other board. Only thing I need to do now is to check for winning when the piece falls into one of the two possible middle spots for the 7 directions. Should be fun.

Edit 2:

Added the remaining win checks:



And it doesn't seem to error out where ever you decide to drop the coin, so that's a good thing. Going to try to do a little bit of polishing work with it before I drop it for a public beta. Plus the Readme and all that.

http://tifreakware.net/tifreak8x/connect4/BB.8xp

In case any of you that own this calculator would like to play around and help me test. It would be very greatly appreciated!
This looks great, tifreak. I think the simplified board looks and works great, so props to Ashbad for suggesting it and you for implementing it. The drawing of the tokens doesn't take too too long, and without the animation it seems quite fast and easy to play. I can't try it right now, but it definitely looks fun. Can you explain the algorithm you used for detection? Are you still using lists?
Yes, I'm still using lists. Win detection could probably be simplified in some manner, but I think it might take a Weregoose to accomplish that.

The win detection basically does a conditional to make sure that the coin falls in certain areas of the board, and then I make use of the sum( statement to check for 4 spots on the board:


Code:
If Z>3 and L>0
sum({L1(M),L1(M+1),L1(M+2),L1(M+3)})/4->L4(1
If Z>3 and L>3
sum({L1(M),L1(M-5),L1(M-10),L1(M-15)})/4->L4(2
If Z>0 and L>3
sum({L1(M),L1(M-6),L1(M-12),L1(M-18)})/4->L4(3
If Z<4 and L>3
sum({L1(M),L1(M-7),L1(M-14),L1(M-21)})/4->L4(4
If Z<4 and L<5
sum({L1(M),L1(M+5),L1(M+10),L1(M+15)})/4->L4(5
If Z>0 and L<5
sum({L1(M),L1(M+6),L1(M+12),L1(M+18)})/4->L4(6
If Z>3 and L<5
sum({L1(M),L1(M+7),L1(M+14),L1(M+21)})/4->L4(7
If (Z>1 and L>1) and (Z<6 and L<6
sum({L1(M),L1(M-5),L1(M+5),L1(M+10)})/4->L4(8
If (Z>2 and L>2) and (Z<6 and L<7
sum({L1(M),L1(M+5),L1(M-5),L1(M-10)})/4->L4(9
If (Z>0 and L>1) and (Z<6 and L<6
sum({L1(M),L1(M-6),L1(M+6),L1(M+12)})/4->L4(10
If (Z>0 and L<7) and (Z<6 and L>2
sum({L1(M),L1(M+6),L1(M-6),L1(M-12)})/4->L4(11
If (Z<6 and L>1) and (Z>2 and L<6
sum({L1(M),L1(M-7),L1(M+7),L1(M+14)})/4->L4(12
If (Z<5 and L>2) and (Z>1 and L<7
sum({L1(M),L1(M+7),L1(M-7),L1(M-14)})/4->L4(13
If max(1=L4) or max(5=L4:Then
TextColor(10+U-3(U=5
Text(1,1,"Player ",U-3(U=5)," Wins!


Thanks for the support, and I look forward to your review once you get a chance to throw it on hardware and do some real testing Smile
here is my block code for my Prizm connect-four game:


Code:
if((board[0][0] == 0) && (Player == 2))  {
      board[0][0] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 8, 181, 34, 34);
         Bdisp_PutDisp_DD();
         board[0][0] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[0][0] = 0;
         Winner = 0;
      }
   }
   else if((board[1][0] == 0) && (Player == 2))  {
      board[1][0] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 8, 145, 34, 34);
         Bdisp_PutDisp_DD();
         board[1][0] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[1][0] = 0;
         Winner = 0;
      }
   }
   else if((board[2][0] == 0) && (Player == 2))  {
      board[2][0] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 8, 109, 34, 34);
         Bdisp_PutDisp_DD();
         board[2][0] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[2][0] = 0;
         Winner = 0;
      }
   }
   else if((board[3][0] == 0) && (Player == 2))  {
      board[3][0] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 8, 73, 34, 34);
         Bdisp_PutDisp_DD();
         board[3][0] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[3][0] = 0;
         Winner = 0;
      }
   }
   else if((board[4][0] == 0) && (Player == 2))  {
      board[4][0] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 8, 37, 34, 34);
         Bdisp_PutDisp_DD();
         board[4][0] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[4][0] = 0;
         Winner = 0;
      }
   }
   else if((board[5][0] == 0) && (Player == 2))  {
      board[5][0] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 8, 2, 34, 34);
         Bdisp_PutDisp_DD();
         board[5][0] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[5][0] = 0;
         Winner = 0;
      }
   }
   CheckForWinner();
   if((board[0][1] == 0) && (Player == 2))  {
      board[0][1] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 59, 181, 34, 34);
         Bdisp_PutDisp_DD();
         board[0][1] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[0][1] = 0;
         Winner = 0;
      }
   }
   else if((board[1][1] == 0) && (Player == 2))  {
      board[1][1] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 59, 145, 34, 34);
         Bdisp_PutDisp_DD();
         board[1][1] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[1][1] = 0;
         Winner = 0;
      }
   }
   else if((board[2][1] == 0) && (Player == 2))  {
      board[2][1] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 59, 109, 34, 34);
         Bdisp_PutDisp_DD();
         board[2][1] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[2][1] = 0;
         Winner = 0;
      }
   }
   else if((board[3][1] == 0) && (Player == 2))  {
      board[3][1] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 59, 73, 34, 34);
         Bdisp_PutDisp_DD();
         board[3][1] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[3][1] = 0;
         Winner = 0;
      }
   }
   else if((board[4][1] == 0) && (Player == 2))  {
      board[4][1] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 59, 37, 34, 34);
         Bdisp_PutDisp_DD();
         board[4][1] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[4][1] = 0;
         Winner = 0;
      }
   }
   else if((board[5][1] == 0) && (Player == 2))  {
      board[5][1] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 59, 2, 34, 34);
         Bdisp_PutDisp_DD();
         board[5][1] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[5][1] = 0;
         Winner = 0;
      }
   }
   CheckForWinner();
   if((board[0][2] == 0) && (Player == 2))  {
      board[0][2] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 110, 181, 34, 34);
         Bdisp_PutDisp_DD();
         board[0][2] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[0][2] = 0;
         Winner = 0;
      }
   }
   else if((board[1][2] == 0) && (Player == 2))  {
      board[1][2] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 110, 145, 34, 34);
         Bdisp_PutDisp_DD();
         board[1][2] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[1][2] = 0;
         Winner = 0;
      }
   }
   else if((board[2][2] == 0) && (Player == 2))  {
      board[2][2] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 110, 109, 34, 34);
         Bdisp_PutDisp_DD();
         board[2][2] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[2][2] = 0;
         Winner = 0;
      }
   }
   else if((board[3][2] == 0) && (Player == 2))  {
      board[3][2] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 110, 73, 34, 34);
         Bdisp_PutDisp_DD();
         board[3][2] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[3][2] = 0;
         Winner = 0;
      }
   }
   else if((board[4][2] == 0) && (Player == 2))  {
      board[4][2] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 110, 37, 34, 34);
         Bdisp_PutDisp_DD();
         board[4][2] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[4][2] = 0;
         Winner = 0;
      }
   }
   else if((board[5][2] == 0) && (Player == 2))  {
      board[5][2] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 110, 2, 34, 34);
         Bdisp_PutDisp_DD();
         board[5][2] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[5][2] = 0;
         Winner = 0;
      }
   }
   CheckForWinner();
   if((board[0][3] == 0) && (Player == 2))  {
      board[0][3] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 161, 181, 34, 34);
         Bdisp_PutDisp_DD();
         board[0][3] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[0][3] = 0;
         Winner = 0;
      }
   }
   else if((board[1][3] == 0) && (Player == 2))  {
      board[1][3] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 161, 145, 34, 34);
            Bdisp_PutDisp_DD();
            board[1][3] = 2;
            Winner = 0;
            Player = 1;
      }
      else  {
         board[1][3] = 0;
         Winner = 0;
      }
   }
   else if((board[2][3] == 0) && (Player == 2))  {
      board[2][3] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 161, 109, 34, 34);
         Bdisp_PutDisp_DD();
         board[2][3] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[2][3] = 0;
         Winner = 0;
      }
   }
   else if((board[3][3] == 0) && (Player == 2))  {
      board[3][3] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 161, 73, 34, 34);
         Bdisp_PutDisp_DD();
         board[3][3] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[3][3] = 0;
         Winner = 0;
      }
   }
   else if((board[4][3] == 0) && (Player == 2))  {
      board[4][3] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 161, 37, 34, 34);
         Bdisp_PutDisp_DD();
         board[4][3] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[4][3] = 0;
         Winner = 0;
      }
   }
   else if((board[5][3] == 0) && (Player == 2))  {
      board[5][3] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 161, 2, 34, 34);
         Bdisp_PutDisp_DD();
         board[5][3] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[5][3] = 0;
         Winner = 0;
      }
   }
   CheckForWinner();
   if((board[0][4] == 0) && (Player == 2))  {
      board[0][4] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 212, 181, 34, 34);
         Bdisp_PutDisp_DD();
         board[0][4] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[0][4] = 0;
         Winner = 0;
      }
   }
   else if((board[1][4] == 0) && (Player == 2))  {
      board[1][4] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 212, 145, 34, 34);
         Bdisp_PutDisp_DD();
         board[1][4] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[1][4] = 0;
         Winner = 0;
      }
   }
   else if((board[2][4] == 0) && (Player == 2))  {
      board[2][4] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 212, 109, 34, 34);
         Bdisp_PutDisp_DD();
         board[2][4] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[2][4] = 0;
         Winner = 0;
      }
   }
   else if((board[3][4] == 0) && (Player == 2))  {
      board[3][4] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 212, 73, 34, 34);
         Bdisp_PutDisp_DD();
         board[3][4] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[3][4] = 0;
         Winner = 0;
      }
   }
   else if((board[4][4] == 0) && (Player == 2))  {
      board[4][4] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 212, 37, 34, 34);
         Bdisp_PutDisp_DD();
         board[4][4] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[4][4] = 0;
         Winner = 0;
      }
   }
   else if((board[5][4] == 0) && (Player == 2))  {
      board[5][4] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 212, 2, 34, 34);
         Bdisp_PutDisp_DD();
         board[5][4] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[5][4] = 0;
         Winner = 0;
      }
   }
   CheckForWinner();
   if((board[0][5] == 0) && (Player == 2))  {
      board[0][5] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 263, 181, 34, 34);
         Bdisp_PutDisp_DD();
         board[0][5] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[0][5] = 0;
         Winner = 0;
      }
   }
   else if((board[1][5] == 0)  && (Player == 2)) {
      board[1][5] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 263, 145, 34, 34);
         Bdisp_PutDisp_DD();
         board[1][5] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[1][5] = 0;
         Winner = 0;
      }
   }
   else if((board[2][5] == 0)  && (Player == 2)) {
      board[2][5] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 263, 109, 34, 34);
         Bdisp_PutDisp_DD();
         board[2][5] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[2][5] = 0;
         Winner = 0;
      }
   }
   else if((board[3][5] == 0) && (Player == 2))  {
      board[3][5] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 263, 73, 34, 34);
         Bdisp_PutDisp_DD();
         board[3][5] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[3][5] = 0;
         Winner = 0;
      }
   }
   else if((board[4][5] == 0) && (Player == 2))  {
      board[4][5] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 263, 37, 34, 34);
         Bdisp_PutDisp_DD();
         board[4][5] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[4][5] = 0;
         Winner = 0;
      }
   }
   else if((board[5][5] == 0) && (Player == 2))  {
      board[5][5] = 1;
      CheckForWinner();
      if(Winner == 1)  {
         CopySprite(black, 263, 2, 34, 34);
         Bdisp_PutDisp_DD();
         board[5][5] = 2;
         Winner = 0;
         Player = 1;
      }
      else  {
         board[5][5] = 0;
         Winner = 0;
      }
   }
   CheckForWinner();
krazylegodrummer56 wrote:
here is my block code for my Prizm connect-four game:


Whew, talk about long! I'd suggest you take a look at Tifreak's code; it's in a different language, sure, but a lot of the techniques that he uses could be extended to C easily. Wink
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement