No, it was just a suggestion what you could do with what you have now, the game board.
But if you like it, you can have the idea and make a game like it based on the current project.
If you like it, it's your objective, your goal.
So you can start and slowly go through the steps and make this game (or a similar game or a totally different game) bit by bit. Print the to do list, tick off what you have done. As you go on, you need to modify steps and fill possible gaps in the plan (e.g. displaying how many money each player has).
But to do something with your current code, you need an idea or a game idea. You need a plan, break this plan down into steps and then follow them to reach a goal.
Other ideas
of course you can have another game idea like doing the real Settlers of Catan (with numbers on the hexagons and 2 dices):
Chrisir doing some thinking on your code and i was wondering how would you add a new statement for example if any tile besides ocean is beside ocean.
if the non ocean tile is touching a ocean tile display a yellow quad on the non ocean tile where the too tiles connect. I was thinking it would have too be like this statement here.
switch (direction) {
case 0: //north
newFieldIndex = startingNewGroupWhere -1;
if (newFieldIndex >= 0 && newFieldIndex < AmountOfTiles)
TileColors[newFieldIndex] = startingNewGroupType;
break;
case 1: //north east
newFieldIndex= startingNewGroupWhere + 28;
if (newFieldIndex >= 0 && newFieldIndex < AmountOfTiles)
TileColors[newFieldIndex] = startingNewGroupType;
break;
case 2: //south east
newFieldIndex= startingNewGroupWhere + 29;
if (newFieldIndex >= 0 && newFieldIndex < AmountOfTiles)
TileColors[newFieldIndex] = startingNewGroupType;
break;
case 3: //south
newFieldIndex= startingNewGroupWhere - 1;
if (newFieldIndex >= 0 && newFieldIndex < AmountOfTiles)
TileColors[newFieldIndex] = startingNewGroupType;
break;
case 4: //south west
newFieldIndex= startingNewGroupWhere - 29;
if (newFieldIndex >= 0 && newFieldIndex < AmountOfTiles)
TileColors[newFieldIndex] = startingNewGroupType;
break;
case 5: //north west
newFieldIndex= startingNewGroupWhere - 28;
if (newFieldIndex >= 0 && newFieldIndex < AmountOfTiles)
TileColors[newFieldIndex] = startingNewGroupType;
break;
}
The latter fills gaps between patches. It basically goes through all tiles (in a random order) and checks if this tile (A) is empty. If so, it checks its neighbours. When one neighbour has a color, (A) is set to that color. That means, the existing patch grows.
Your question:
No.
I don't think it works. Does it?
if the non ocean tile is touching a ocean tile display a yellow quad on the non ocean tile where the two tiles connect
This:
case 0: //north
newFieldIndex = startingNewGroupWhere -1;
if (newFieldIndex >= 0 && newFieldIndex < AmountOfTiles)
TileColors[newFieldIndex] = startingNewGroupType;
break;
could be
case 0: //north
// index start field = startingNewGroupWhere
// index new field = newFieldIndex
newFieldIndex = startingNewGroupWhere -1;
if (newFieldIndex >= 0 && newFieldIndex < AmountOfTiles)
if (TileColors[startingNewGroupWhere] != OCEAN)
if (TileColors[newFieldIndex] == OCEAN) {
TileColors[newFieldIndex] = -4; // indicating: display a yellow quad
}
break;
several issues here:
to display a yellow quad somewhere you need a data structure to tell you which hexagons have a yellow quad. You could make a new array parallel to TileColors and name it boolean TileHoldsYellowQuad. Then set the value of TileHoldsYellowQuad[newFieldIndex] to true. Understand that the index newFieldIndex in TileHoldsYellowQuad is the same index as in TileColors. In that they are parallel: The properties of the hexagon is in the same line in the two arrays.
But then in draw or so you need a functionality to display a yellow quad based on the data in TileHoldsYellowQuad.
Chrisir i notice in the new patches generation code that the AI jumps screen i think what the problem is that if its at the last tile in the column then it moves south it jumps to the next column. I have a idea on how to fix code down below.
if (AI's y == to last tile in the column) {
if (direction == north) {
AI's y - 1;
}
if (direction == north east) {
AI's x + 1; AI's y + column.length;
}
if (direction == north west) {
AI's x - 1; AI's y - column.length;
}
} else if (column % 2 && AI's y == to last tile in the column) {
if (direction == north) {
AI's y - 1;
}
if (direction == north east) {
AI's x + 1; AI's y + column.length;
}
if (direction == north west) {
AI's x - 1; AI's y - column.length;
}
if (direction == south west) {
AI's x - 1;
}
if (direction == south east) {
AI's x + 1;
}
}
else {
if (direction == north) {
AI's y - 1;
}
if (direction == north east) {
AI's x + 1; AI's y + column.length;
}
if (direction == north west) {
AI's x - 1; AI's y - column.length;
}
if (direction == south east) {
AI's y + 1;
}
if (direction == south west) {
AI's x - 1;
}
if (direction == south east) {
AI's x + 1;
}
}
This stops him on the edge of the map to jump over to the other side. Just need some help implementing into your code.
Chrisir having trouble com bounding your code and my 2D array the two groups of code together generate the X and Y's different. Can you help the two groups of code are above.
Answers
Is this like a objective layout where you layout everything and slowly go threw and code it until its done to get a end result.
No, it was just a suggestion what you could do with what you have now, the game board.
But if you like it, you can have the idea and make a game like it based on the current project.
If you like it, it's your objective, your goal.
So you can start and slowly go through the steps and make this game (or a similar game or a totally different game) bit by bit. Print the to do list, tick off what you have done. As you go on, you need to modify steps and fill possible gaps in the plan (e.g. displaying how many money each player has).
But to do something with your current code, you need an idea or a game idea. You need a plan, break this plan down into steps and then follow them to reach a goal.
Other ideas
https://forum.processing.org/two/discussion/25944/hexagon-pattern
https://forum.processing.org/two/discussion/25944/hexagon-pattern#latest
https://github.com/Kango/Games
Chrisir
Yeah that is true. The board game can be applied to any game.
I edited my post, you might want to hit F5 to see the changes
Thanks for post. I think i will try to do just that make a kind of new board game and have goals and objectives to do. Thanks again for the post.
;-)
Chrisir doing some thinking on your code and i was wondering how would you add a new statement for example if any tile besides ocean is beside ocean.
if the non ocean tile is touching a ocean tile display a yellow quad on the non ocean tile where the too tiles connect. I was thinking it would have too be like this statement here.
When we talk about distributing the colors:
There are two main functions:
patches(); and
fillGapsBetweenPatches();
The latter fills gaps between patches. It basically goes through all tiles (in a random order) and checks if this tile (A) is empty. If so, it checks its neighbours. When one neighbour has a color, (A) is set to that color. That means, the existing patch grows.
Your question:
No.
I don't think it works. Does it?
This:
could be
several issues here: to display a yellow quad somewhere you need a data structure to tell you which hexagons have a yellow quad. You could make a new array parallel to TileColors and name it boolean TileHoldsYellowQuad. Then set the value of TileHoldsYellowQuad[newFieldIndex] to true. Understand that the index newFieldIndex in TileHoldsYellowQuad is the same index as in TileColors. In that they are parallel: The properties of the hexagon is in the same line in the two arrays.
But then in draw or so you need a functionality to display a yellow quad based on the data in TileHoldsYellowQuad.
Like a for loop
i
and thenChrisir
That works.
Well done!
Chrisir i notice in the new patches generation code that the AI jumps screen i think what the problem is that if its at the last tile in the column then it moves south it jumps to the next column. I have a idea on how to fix code down below.
This stops him on the edge of the map to jump over to the other side. Just need some help implementing into your code.
That’s why I said we want a 2D grid instead
But it’s ok with a 2D grid as well
My approach was the function tooFar. It can detect if the new tile is too far away from the previous
If so it’s just went over the side
That is the grid we are using now. I did make a 2d grid but didn't implement in to the other code. Here's the code.
Did you see this:
You need to implement tooFar into the AI and let it bounce
What do you mean by bounce.
Instead of popping up on the other side of the screen, it reverses direction and goes away from the border towards center again
O okay that makes sense now.
Chrisir having trouble com bounding your code and my 2D array the two groups of code together generate the X and Y's different. Can you help the two groups of code are above.
Forget the 2D
Let’s just stick with 1D
Ok?
Okay is it easier with a 2D array or easier with a 1D array in this sort of area.
1D is working so let’s stick with it
Okay.