/// <summary> /// Respond to user-triggered puzzle actions /// </summary> /// <param name="sender">Object that triggered the event handler</param> /// <param name="e">Object encapsulating event properties and methods</param> private void pnlPuzzle_MouseClick(object sender, MouseEventArgs e) { // Identify game-based location of the mouse pointer var here = new Point(e.X, e.Y); // Save location, but only if mouse is over the true game area if (trans.OnGame(here)) { mouseLocation = trans.GameFromPhysical(here); } lblFeedback.Text = "Clicked at " + mouseLocation.ToString(trans.HintZoneUnknown); string.Format("Clicked at Row: {0:d}, Col: {1:d}", mouseLocation.Row, mouseLocation.Column); // Click close enough to a hint zone? if (!(mouseLocation.HintZone == trans.HintZoneUnknown)) { // Save a snapshot of the game as it currently stands gameHistory.Push(game.DeepClone); //TODO: Modify game RefreshPuzzle(); } //TODO: Determine action, if any, when clicking outside a hint zone }
public void Triad_ToStringParam_ExcludingHint() { var row = rand.Next(); var column = rand.Next(); var hintZone = rand.Next(); var t = new Triad(row, column, hintZone); var expected = "Row: " + row.ToString("d") + ", Col: " + column.ToString("d"); var actual = t.ToString(hintZone); // Intentionally matches HintZone value Assert.AreEqual(expected, actual); }
public void Triad_ToString_Valid() { var row = rand.Next(); var column = rand.Next(); var hintZone = rand.Next(); var t = new Triad(row, column, hintZone); var expected = "(" + row.ToString("d") + ", " + column.ToString("d") + ", " + hintZone.ToString("d") + ")"; var actual = t.ToString(); Assert.AreEqual(expected, actual); }