public bool VerificaParede(IElement[,] terreno, Veiculo motinha, int[,] sentido) { bool teste = true;; if (sentido[0, 1] > 0) // E { if (motinha.XPos + sentido[0, 1] * QuantidadeMov >= terreno.GetLength(1) - 1) { if (motinha is Escavadora) { terreno[YPos, XPos] = null; XPos = 1; terreno[YPos, XPos] = motinha; } teste = false; } } else if (sentido[0, 1] < 0) //W { if (motinha.XPos + sentido[0, 1] * QuantidadeMov <= 0) { if (motinha is Escavadora) { terreno[YPos, XPos] = null; XPos = terreno.GetLength(1) - 2; terreno[YPos, XPos] = motinha; } teste = false; } } if (sentido[1, 0] > 0) // S { if (motinha.YPos + sentido[1, 0] * QuantidadeMov >= terreno.GetLength(0) - 1) { if (motinha is Escavadora) { terreno[YPos, XPos] = null; YPos = 1; terreno[YPos, XPos] = motinha; } teste = false; } } else if (sentido[1, 0] < 0) // N { if (motinha.YPos + sentido[1, 0] * QuantidadeMov <= 0) { if (motinha is Escavadora) { terreno[YPos, XPos] = null; YPos = terreno.GetLength(0) - 2; terreno[YPos, XPos] = motinha; } teste = false; } } return(teste); }
public TableElement(int rows, int cols) : base("table") { this.rows = rows; this.cols = cols; this.childElements = new IElement[rows, cols]; }
public HTMLTable(int rows, int cols) : base(TableName) { this.Rows = rows; this.Cols = cols; this.cells = new IElement[this.Rows, this.Cols]; }
public Table(int rows, int cols) : base(Table.TableName) { this.Rows = rows; this.Cols = cols; this.table = new IElement[Rows, Cols]; }
public HtmlTable(int rows, int cols) : base(tableName, tableContent) { this.Rows = rows; this.Cols = cols; tableElements = new HtmlElement[Rows, Cols]; }
/// <summary> /// Compares the element to another. /// </summary> /// <param name="obj">Other element to compare against.</param> /// <returns>If elements are equal.</returns> public override bool Equals(object obj) { ObjectMatrix Matrix = obj as ObjectMatrix; if (Matrix == null) { return(false); } if (this.columns != Matrix.columns || this.rows != Matrix.rows) { return(false); } IElement[,] V1 = this.Values; IElement[,] V2 = Matrix.Values; int x, y; for (y = 0; y < this.rows; y++) { for (x = 0; x < this.columns; x++) { if (V1[y, x] != V2[y, x]) { return(false); } } } return(true); }
/// <summary> /// Object-valued matrix. /// </summary> /// <param name="Values">Object value.</param> public ObjectMatrix(IElement[,] Values) { this.values = Values; this.elements = null; this.rows = Values.GetLength(0); this.columns = Values.GetLength(1); }
public HTMLTable(int rows, int cols) : base("table") { this.Rows = rows; this.Cols = cols; this.tableElements = new IElement[rows, cols]; }
public HTMLTable(int rows, int cols) : base("table", null) { this.Rows = rows; this.Cols = cols; this.innerTable = new IElement[Rows, Cols]; }
/// <summary> /// Object-valued vector. /// </summary> /// <param name="Rows">Number of rows.</param> /// <param name="Columns">Number of columns.</param> /// <param name="Elements">Elements.</param> public ObjectMatrix(int Rows, int Columns, ICollection <IElement> Elements) { this.values = null; this.elements = Elements; this.rows = Rows; this.columns = Columns; }
public TableElement(int rows, int cols) { this.Name = "table"; this.Rows = rows; this.Cols = cols; this.elements = new IElement[rows, cols]; }
/// <summary> /// Sets an element in the vector. /// </summary> /// <param name="Index">Index.</param> /// <param name="Value">Element to set.</param> public void SetElement(int Index, IElement Value) { if (Index < 0 || Index >= this.rows) { throw new ScriptException("Index out of bounds."); } IVector V = Value as IVector; if (V == null) { throw new ScriptException("Invalid row vector."); } if (V.Dimension != this.columns) { throw new ScriptException("Dimension mismatch."); } IElement[,] M = this.Values; this.elements = null; int i = 0; foreach (IElement E in V.ChildElements) { M[Index, i++] = E; } }
public HTMLTable(int rows, int cols) : base("table", null) { this.Rows = rows; this.Cols = cols; this.innerTable = new IElement[Rows, Cols]; }
public Table(int rows, int cols) : base("table") { this.Rows = rows; this.Cols = cols; this.elements = new Element[this.Rows, this.Cols]; }
// constructors public Table(int inputRows, int inputCols) : base("table") { this.Rows = inputRows; this.Cols = inputCols; this.tableElements = new IElement[this.Rows, this.Cols]; }
public HTMLTable(int rows, int cols) { this.Rows = rows; this.Cols = cols; this.Name = "table"; this.cells = new IElement[rows, cols]; }
// Constructors public HTMLTable(int rows, int cols) : base(TableName) { this.Rows = rows; this.Cols = cols; this.cells = new IElement[this.Rows, this.Cols]; }
public HTMLTable(int rows, int cols) : base("table") { this.Rows = rows; this.Cols = cols; this.elements = new IElement[rows, cols]; }
public Table(int rows, int cols) { this.rows = rows; this.cols = cols; this.table = new HTMLElement[rows, cols]; this.name = "table"; }
public void Move(IElement[,] terreno, Veiculo motinha, int[,] sentido) { terreno[YPos, XPos] = null; XPos = XPos + sentido[0, 1] * QuantidadeMov; YPos = YPos + sentido[1, 0] * QuantidadeMov; terreno[YPos, XPos] = motinha; }
public Table(int rows, int cols) : base(TableName) { this.Rows = rows; this.Cols = cols; this.tableData = new IElement[this.Rows, this.Cols]; }
public Table(int rows,int cols) : base("table",name) { this.rows = rows; this.cols = cols; this.cells = new IElement[this.Rows,this.Cols]; }
public HtmlTable(int rows, int columns) : base(TableName, TableTextContent) { this.Rows = rows; this.Cols = columns; elements = new IElement[Rows, Cols]; }
public HTMLTable(int rows, int cols) : base(HTMLTable.TableName) { this.Rows = rows; this.Cols = cols; this.table = new IElement[rows, cols]; }
/// <summary> /// Tries to multiply an element to the current element, from the left. /// </summary> /// <param name="Element">Element to multiply.</param> /// <returns>Result, if understood, null otherwise.</returns> public override IRingElement MultiplyLeft(IRingElement Element) { IElement[,] Values = this.Values; ObjectMatrix Matrix; IElement[,] v; IElement n; int x, y, z; if (Element.IsScalar) { v = new IElement[this.rows, this.columns]; for (y = 0; y < this.rows; y++) { for (x = 0; x < this.columns; x++) { v[y, x] = Operators.Arithmetics.Multiply.EvaluateMultiplication(Element, Values[y, x], null); } } return(new ObjectMatrix(v)); } else if (!((Matrix = Element as ObjectMatrix) is null)) { if (Matrix.columns != this.rows) { return(null); } IElement[,] Values2 = Matrix.Values; v = new IElement[Matrix.rows, this.columns]; for (y = 0; y < Matrix.rows; y++) { for (x = 0; x < this.columns; x++) { n = null; for (z = 0; z < this.rows; z++) { if (n is null) { n = Operators.Arithmetics.Multiply.EvaluateMultiplication(Values2[y, z], Values[z, x], null); } else { n = Operators.Arithmetics.Add.EvaluateAddition(n, Operators.Arithmetics.Multiply.EvaluateMultiplication(Values2[y, z], Values[z, x], null), null); } } v[y, x] = n; } } return(new ObjectMatrix(v)); }
public HTMLTable(int rows, int cols) : base(InitialHTMLTableName) { this.Rows = rows; this.Cols = cols; this.tableElements = new IElement[rows, cols]; }
public HTMLTable(int rows, int cols) : base(InitialHTMLTableName) { this.Rows = rows; this.Cols = cols; this.tableElements = new IElement[rows, cols]; }
public HtmlTable(int rows, int cols) : base(TableName) { this.Rows = rows; this.Cols = cols; this.childElements = new IElement[this.Rows, this.Cols]; }
public HtmlTable(int rows, int cols) : base(TableName) { this.Rows = rows; this.Cols = cols; this.childElements = new IElement[this.Rows, this.Cols]; }
public Table(int rows, int cols, string name = null, string content = null) : base(name, content) { this.Rows = rows; this.Cols = cols; this.matrix = new IElement[rows, cols]; }
public Terreno(int numLinhas, int numColunas) { _numLinhas = numLinhas; _numColunas = numColunas; terreno = new IElement[_numLinhas, _numColunas]; }
public Table(int row, int col) : base() { this.Name = tableName; this.TextContent = null; this.ChildElements = null; this.Rows = row; this.Cols = col; this.table = new IElement[this.Rows, this.Cols]; }
public void SetVeiculo(IElement[,] terreno, Veiculo motinha) { rnd = new Random(); do { YPos = rnd.Next(1, terreno.GetLength(0) - 1); XPos = rnd.Next(1, terreno.GetLength(1) - 1); } while (terreno[YPos, XPos] != null); terreno[YPos, XPos] = motinha; }
/// <summary> /// Sets an element in the matrix. /// </summary> /// <param name="Column">Zero-based column index into the matrix.</param> /// <param name="Row">Zero-based row index into the matrix.</param> /// <param name="Value">Element value.</param> public void SetElement(int Column, int Row, IElement Value) { if (Column < 0 || Column >= this.columns || Row < 0 || Row >= this.rows) { throw new ScriptException("Index out of bounds."); } IElement[,] M = this.Values; this.elements = null; M[Row, Column] = Value; }
public OperationTable(ICollection<IElement> elements, bool firstElementIsIdentity) { this.elements = new List<IElement>(elements); this.cells = new IElement[elements.Count, elements.Count]; if (firstElementIsIdentity) for (int k = 0; k < this.elements.Count; k++) { this.cells[k, 0] = this.elements[k]; this.cells[0, k] = this.elements[k]; } }
public IElement this[int row, int col] { get { return(matrix[row, col]); } set { this.matrix = value; } }
public HTMLTable(int rows, int cols) : base("table") { if (rows <= 0) { throw new ArgumentOutOfRangeException("rows", 0, "Positive number required."); } if (cols <= 0) { throw new ArgumentOutOfRangeException("cols", 0, "Positive number required."); } this.Rows = rows; this.Cols = cols; this.tableElements = new IElement[rows, cols]; }
public OperationTable(ICollection <IElement> elements, bool firstElementIsIdentity) { this.elements = new List <IElement>(elements); this.cells = new IElement[elements.Count, elements.Count]; if (firstElementIsIdentity) { for (int k = 0; k < this.elements.Count; k++) { this.cells[k, 0] = this.elements[k]; this.cells[0, k] = this.elements[k]; } } }
public HTMLTable(int rows, int cols) : base("table") { if (rows <= 0) { throw new ArgumentOutOfRangeException("rows", 0, "Positive number required."); } if (cols <= 0) { throw new ArgumentOutOfRangeException("cols", 0, "Positive number required."); } this.Rows = rows; this.Cols = cols; this.tableElements = new IElement[rows, cols]; }
/// <summary> /// Returns a transposed matrix. /// </summary> /// <returns>Transposed matrix.</returns> public IMatrix Transpose() { IElement[,] v = new IElement[this.columns, this.rows]; IElement[,] Values = this.Values; int x, y; for (y = 0; y < this.rows; y++) { for (x = 0; x < this.columns; x++) { v[x, y] = Values[y, x]; } } return(new ObjectMatrix(v)); }
/// <summary> /// Negates the element. /// </summary> /// <returns>Negation of current element.</returns> public override IGroupElement Negate() { IElement[,] Values = this.Values; IElement[,] v = new IElement[this.rows, this.columns]; int x, y; for (y = 0; y < this.rows; y++) { for (x = 0; x < this.columns; x++) { v[y, x] = Operators.Arithmetics.Negate.EvaluateNegation(Values[y, x]); } } return(new ObjectMatrix(v)); }
/// <summary> /// Tries to add an element to the current element. /// </summary> /// <param name="Element">Element to add.</param> /// <returns>Result, if understood, null otherwise.</returns> public override IAbelianGroupElement Add(IAbelianGroupElement Element) { IElement[,] Values = this.Values; ObjectMatrix Matrix; IElement[,] v; int x, y; if (Element.IsScalar) { v = new IElement[this.rows, this.columns]; for (y = 0; y < this.rows; y++) { for (x = 0; x < this.columns; x++) { v[y, x] = Operators.Arithmetics.Add.EvaluateAddition(Element, this.values[y, x], null); } } return(new ObjectMatrix(v)); } else if ((Matrix = Element as ObjectMatrix) != null) { if (this.columns != Matrix.columns || this.rows != Matrix.rows) { return(null); } IElement[,] Values2 = Matrix.Values; v = new IElement[this.rows, this.columns]; for (y = 0; y < this.rows; y++) { for (x = 0; x < this.columns; x++) { v[y, x] = Operators.Arithmetics.Add.EvaluateAddition(Values[y, x], Values2[y, x], null); } } return(new ObjectMatrix(v)); } else { return(null); } }
/// <summary> /// <see cref="Object.ToString()"/> /// </summary> public override string ToString() { IElement[,] v = this.Values; StringBuilder sb = null; bool First; int x, y; for (y = 0; y < this.rows; y++) { if (sb == null) { sb = new StringBuilder("[["); } else { sb.Append(",\r\n ["); } First = true; for (x = 0; x < this.columns; x++) { if (First) { First = false; } else { sb.Append(", "); } sb.Append(v[y, x].ToString()); } sb.Append(']'); } if (sb == null) { sb = new StringBuilder("[[]]"); } else { sb.Append(']'); } return(sb.ToString()); }
public HTMLTable(int rows, int cols) : base(TableName) { this.tableContent = new IElement[rows, cols]; }
public Table(int rows, int columns) { this.Rows = rows; this.Cols = columns; this.elements = new IElement[rows, columns]; }
public OperationTable(OperationTable table) { this.elements = new List<IElement>(table.elements); this.cells = new IElement[this.elements.Count, this.elements.Count]; Array.Copy(table.cells, this.cells, this.elements.Count * this.elements.Count); }
public Table(int rows, int cols) : base(tableName, null) { this.Rows = rows; this.Cols = cols; this.cells = new IElement[rows, cols]; }
public Table(int rows, int cols) { this.rows = rows; this.cols = cols; this.table = new HTMLElement[rows, cols]; this.name = "table"; }
public HtmlTable(int rows, int cols) : base(TableName) { this.htmlElements = new HtmlElement[rows, cols]; }
public HTMLTable(int rows, int cols, string name = "table") { this.Rows = rows; this.Cols = cols; this.cellElements = new IElement[rows, cols]; }
public Table(int rows, int cols) : base("table") { this.arr = new IElement[rows, cols]; }
public Table(int rows, int cols) { this.matrix = new Element[rows, cols]; }
public HTMLTable(int rows, int cols) : base(rows, cols) { this.Name = TableName; this.table = new IElement[rows, cols]; }
public HTMLTable(int rows, int cols) { this.rows = rows; this.cols = cols; this.table = new IElement[this.Rows, this.Cols]; }
public Table(int rows, int cols) : base(tableName) { this.matrix = new IElement[rows, cols]; }