View allAll Photos Tagged findsolutions
*Working Towards a Better World
This is for all my Greek friends, I wish you to know that I feel your pain and want nothing more than for the Greek situation to be satisfactorily solved. I know and understand that you are all in dire straits and must be very frightened for your future! I am rooting for you all and send love, positive vibes and thoughts your way my friends! In my heart I feel sure that a solution will be found, it may take time but things will work out in the end! xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️xo❤️
Thank you for your kind visit. Have a wonderful and beautiful day! xo❤️
*Working Towards a Better World
Today, not tomorrow is the time to reach out, find solutions together and embrace our differences the world over, come on my friends, let's do it!
private readonly char[] _colors = new[]
{'R', 'O', 'Y', 'G', 'B', 'P'};
// the board starts with two towers placed,
// because they break the height rules.
private readonly char[,] _startingBoard = new[,]
{
{'1', '2', '5', '4', '6', '3'},
{'5', '3', '6', '1', '4', '2'},
{'4', '6', '3', 'O', '2', '1'},
{'2', '1', '4', '3', '5', '6'},
{'3', '5', '2', 'Y', '1', '4'},
{'6', '4', '1', '2', '3', '5'}
};
private readonly bool[,] _startingTowers = new[,]
{
{true, true, true, true, true, true},
{true, true, true, true, true, false},
{true, true, true, true, false, true},
{true, true, true, true, true, true},
{true, true, true, true, true, true},
{true, true, true, true, true, true}
};
// The game state contains both the board,
// and the list of towers not yet played
struct Game
{
public char[,] Board;
public bool[,] Towers;
}
// a play, aka a turn, aka a move
// consists of taking a tower and
// placing it on the board at a specific
// location with a matching height.
struct Play
{
public int X;
public int Y;
public int ColorIndex;
public int Height;
public char Color;
}
// The Solution
private Game _solution;
public void FindSolution()
{
var game = new Game
{
Board = _startingBoard,
Towers = _startingTowers
};
var solutionFound = RecurseIntoTurn(game, 0);
var solution = _solution;
}
private IEnumerable PossiblePlaysForTurn(Game game, int turn)
{
int x = turn / 6;
int y = turn % 6;
var plays = new List();
if (x == 2 && y == 3)
{
plays.Add(new Play
{
X = x,
Y = y,
ColorIndex = 1,
Color = 'O',
Height = 5
});
return plays;
}
if (x == 4 && y == 3)
{
plays.Add(new Play
{
X = x,
Y = y,
ColorIndex = 2,
Color = 'Y',
Height = 4
});
return plays;
}
int height = int.Parse(game.Board[x, y] + "")-1;
for (int c = 0; c < 6; c++)
{
if (game.Towers[c, height])
{
plays.Add(new Play
{
X = x,
Y = y,
ColorIndex = c,
Color = _colors[c],
Height = height
});
}
}
return plays;
}
private bool IsPlayValid(Game game, Play play)
{
if ((play.X == 2 && play.Y == 3) ||
(play.X == 4 && play.Y == 3))
{
return true;
}
for (int x = 0; x < 6; x++)
{
if (game.Board[x, play.Y] == play.Color)
{
return false;
}
}
for (int y = 0; y < 6; y++)
{
if (game.Board[play.X, y] == play.Color)
{
return false;
}
}
return true;
}
private Game MakePlay(Game game, Play play)
{
var newGame = new Game
{
Board = new char[6,6],
Towers = new bool[6,6]
};
Array.Copy(game.Board, newGame.Board, 36);
Array.Copy(game.Towers, newGame.Towers, 36);
newGame.Board[play.X, play.Y] = play.Color;
newGame.Towers[play.ColorIndex, play.Height] = false;
return newGame;
}
private bool RecurseIntoTurn(Game game, int turn)
{
if (turn == 36)
{
_solution = game;
return true;
}
foreach (var play in PossiblePlaysForTurn(game, turn))
{
if (IsPlayValid(game, play))
{
var newGame = MakePlay(game, play);
if (RecurseIntoTurn(newGame, turn + 1))
{
return true;
}
}
}
return false;
}
Keep in shape, always exercise, choose food your body needs, and assimilates. Drink pure water, tea and juices, give your body relaxation time and don't spend energy on worrying, just find the solutions then choose the best one. :)
Life. It is what make it. You can have any life that you are willing to make. But without being willing to work relentlessly for it. That life may always just be a dream. Life is really simple. You get what you work for. So don't complain about life. Work for it. Make it happen. Don't look for excuses. Find solutions. #fitfam #fitnesslifestyle #fitmom #followme #success #successquotes #workhard #workharder #dreambig #bedetermined #nevergiveup #findsolutions #notexcuses #bewillingtoworkforit #neversettle #focus #bestrong #instamotivation #quoteoftheday #wordstoliveby #instaquote #igers - nicholek09