viable step gate
This commit is contained in:
parent
4762ebc184
commit
64e7b2ea2f
1 changed files with 7 additions and 1 deletions
|
@ -212,9 +212,11 @@ static class Mono
|
||||||
// step from head using directions towards the tail
|
// step from head using directions towards the tail
|
||||||
// and stop at either 1 cell away from the tail or 5 spaces away from the head
|
// and stop at either 1 cell away from the tail or 5 spaces away from the head
|
||||||
bool viable = false;
|
bool viable = false;
|
||||||
|
bool viable_step = false;
|
||||||
XYZi cell = snake[0];
|
XYZi cell = snake[0];
|
||||||
for (int step = 0; step < 5; step++)
|
for (int step = 0; step < 5; step++)
|
||||||
{
|
{
|
||||||
|
viable_step = false;
|
||||||
int min_dist = 100;
|
int min_dist = 100;
|
||||||
XYZi min_cell = new();
|
XYZi min_cell = new();
|
||||||
int[] dir_indices = GetShuffledIndices(directions);
|
int[] dir_indices = GetShuffledIndices(directions);
|
||||||
|
@ -228,9 +230,13 @@ static class Mono
|
||||||
min_dist = tail_dist;
|
min_dist = tail_dist;
|
||||||
min_cell = dir_cell;
|
min_cell = dir_cell;
|
||||||
viable = true;
|
viable = true;
|
||||||
|
viable_step = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cell = min_cell;
|
if (viable_step)
|
||||||
|
{
|
||||||
|
cell = min_cell;
|
||||||
|
}
|
||||||
// if (min_dist <= 1)
|
// if (min_dist <= 1)
|
||||||
// {
|
// {
|
||||||
// break;
|
// break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue