using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace LD_24 { public partial class Forma1 : System.Web.UI.Page { /// /// Put target friends into a bulleted list element /// /// Target list /// Target friends private void ShowFriends(BulletedList list, List friends) { list.Items.Clear(); foreach (var friend in friends) { list.Items.Add(String.Format("X = {0}, Y = {1}", friend.X + 1, friend.Y + 1)); } } /// /// Put best pizzeria result into a label /// /// Target label /// Target result private void ShowBestPizzeriaResult(Label label, Code.BestPizzeriaResult result) { if (result == null) { label.Text = "Neįmanoma"; return; } label.Text = String.Format("Susitikimo vieta (X = {0}, Y = {1})", result.MeetingSpot.X + 1, result.MeetingSpot.Y + 1); label.Text += "
"; label.Text += String.Format("Picerija (X = {0}, Y = {1})", result.Pizzeria.X + 1, result.Pizzeria.Y + 1); label.Text += "
"; label.Text += String.Format("Nueita {0}", result.Cost); } /// /// Put a maps tiles into a table /// /// Target table /// Target map private void ShowMap(Table table, Code.Map map) { table.Rows.Clear(); for (int y = 0; y < map.Height; y++) { TableRow row = new TableRow(); for (int x = 0; x < map.Width; x++) { TableCell cell = new TableCell(); cell.Width = 20; cell.Height = 20; switch (map.Get(x, y)) { case Code.MapTile.Empty: cell.Text = "."; break; case Code.MapTile.Pizzeria: cell.Text = "P"; break; case Code.MapTile.Friend: cell.Text = "D"; break; case Code.MapTile.MeetingSpot: cell.Text = "S"; break; case Code.MapTile.Wall: cell.Text = "X"; break; default: cell.Text = "?"; break; } row.Cells.Add(cell); } table.Rows.Add(row); } } } }