public static void Main() { string[] nameAddressTown = Console.ReadLine().Split(); string name = nameAddressTown[0] + " " + nameAddressTown[1]; string address = nameAddressTown[2]; string town = nameAddressTown[3]; CustomTuple <string, string, string> nameAddressTownTuple = new CustomTuple <string, string, string>(name, address, town); Console.WriteLine(nameAddressTownTuple); string[] nameLitersDrunk = Console.ReadLine().Split(); name = nameLitersDrunk[0]; int liters = int.Parse(nameLitersDrunk[1]); bool isDrunk = nameLitersDrunk[2].Equals("drunk"); CustomTuple <string, int, bool> nameLitersDrunkTuple = new CustomTuple <string, int, bool>(name, liters, isDrunk); Console.WriteLine(nameLitersDrunkTuple); string[] nameBalanceBank = Console.ReadLine().Split(); name = nameBalanceBank[0]; double balance = double.Parse(nameBalanceBank[1]); string bankName = nameBalanceBank[2]; CustomTuple <string, double, string> nameBalanceBankTuple = new CustomTuple <string, double, string>(name, balance, bankName); Console.WriteLine(nameBalanceBankTuple); }
public override CustomTuple GetNext() { while (true) { CustomTuple rightTuple = Right.GetNext(); if (rightTuple == null) { Right.Unprepare(); _leftTuple = Left.GetNext(); Right.Prepare(); } else if (_leftTuple != null && _leftTuple.Joins(rightTuple, _leftJoinColumn, _rightJoinColumn)) { CustomTuple result = _leftTuple; _leftTuple = Left.GetNext(); return(result.Merge(rightTuple)); } if (_leftTuple == null) { return(null); } } }
/// <summary> /// Used to generate a direct path with no backtracking from the defined start and end locations /// </summary> private void GenerateDirectPath() { //setup list of directional transformations List <CustomTuple <int, int> > transformations = new List <CustomTuple <int, int> >(); CalculateSingleDimensionTransforms(transformations, new CustomTuple <int, int>(1, 0), end.x - start.x); CalculateSingleDimensionTransforms(transformations, new CustomTuple <int, int>(0, 1), end.y - start.y); ScrambleList(transformations); //iterate through the scrambled transformations applying each cell group as we go CustomTuple <int, int> currentCellPos = new CustomTuple <int, int>(start.x, start.y); CustomTuple <int, int> lastTrans = new CustomTuple <int, int>(-1, -1); foreach (CustomTuple <int, int> t in transformations) { if (t.x != lastTrans.x || t.y != lastTrans.y) { numTurns += 1; } lastTrans = t; //Debug.Log("Apply Cell Group At: " + currentCellPos.x + ", " + currentCellPos.y); ApplyCellGroupToCodeMap(currentCellPos); currentCellPos.x += t.x; currentCellPos.y += t.y; } //For final block to be included ApplyCellGroupToCodeMap(currentCellPos); }
public static void Main(string[] args) { string[] personInfo = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string firstName = personInfo[0]; string lastName = personInfo[1]; string address = personInfo[2]; CustomTuple <string, string> personTuple = new CustomTuple <string, string>(firstName + " " + lastName, address); string[] personBeerInfo = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = personBeerInfo[0]; int beerLiters = int.Parse(personBeerInfo[1]); CustomTuple <string, int> personBeerTuple = new CustomTuple <string, int>(name, beerLiters); string[] info = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); int myInteger = int.Parse(info[0]); double myDouble = double.Parse(info[1]); CustomTuple <int, double> numbersTuple = new CustomTuple <int, double>(myInteger, myDouble); Console.WriteLine(personTuple.GetInfo()); Console.WriteLine(personBeerTuple.GetInfo()); Console.WriteLine(numbersTuple.GetInfo()); }
/// <summary> /// Applies a cell group pattern to the codemap as a method of path generation, /// or at least generating paths piece by piece in pathSize increments /// </summary> /// <param name="cellLoc">The bottom left corner of the cell group to be applied</param> /// <param name="originIndex">The index at which to add the next cell, -1 means on the end</param> private void ApplyCellGroupToCodeMap(CustomTuple <int, int> cellLoc, int originIndex) { if (originIndex == -1) { allCellOrigins.Add(cellLoc.Copy()); } else { allCellOrigins.Insert(originIndex, cellLoc.Copy()); } //iterate through the entire cell group, border included for (int i = cellLoc.x - 1; i < cellLoc.x + currentPathWidth + 1; i++) { for (int j = cellLoc.y - 1; j < cellLoc.y + currentPathWidth + 1; j++) { //if the current cell is on the border of this group try to make it a border cell if (i == cellLoc.x - 1 || i == cellLoc.x + currentPathWidth || j == cellLoc.y - 1 || j == cellLoc.y + currentPathWidth) { codeMap[i, j] = GetPrevailingCode(codeMap[i, j], 1); } else //if not, try to make it a path cell { codeMap[i, j] = GetPrevailingCode(codeMap[i, j], 0); } } } }
public static void Main() { var first = Console.ReadLine().Split(); var t1 = new CustomTuple <string, string, string>(); t1.Value1 = string.Join(" ", first.Take(first.Length - 2)); t1.Value2 = first[first.Length - 2]; t1.Value3 = first[first.Length - 1]; Console.WriteLine((t1.ToString()) + (t1.Value3)); var second = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var t2 = new CustomTuple <string, int, string>(); t2.Value1 = string.Join(" ", second.Take(second.Length - 2)); t2.Value2 = int.Parse(second[second.Length - 2]); t2.Value3 = second[second.Length - 1]; Console.WriteLine((t2.ToString()) + (t2.Value3 == "drunk" ? "True" : "False")); var third = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var t3 = new CustomTuple <string, double, string>(); t3.Value1 = string.Join(" ", third.Take(third.Length - 2)); t3.Value2 = double.Parse(third[third.Length - 2]); t3.Value3 = third[third.Length - 1]; Console.WriteLine((t3.ToString()) + (t3.Value3)); }
/// <summary> /// Used to determine if a given cell is a path cell /// </summary> /// <param name="pos">The codeMap position of the cell</param> /// <returns>True if the cell is a path or trigger cell, false otherwise</returns> private bool CellIsPath(CustomTuple <int, int> pos) { if (pos == null) { return(false); } return(codeMap[pos.x, pos.y] == 0 || codeMap[pos.x, pos.y] == 3); }
public CustomTuple <int, int> GetCell(int xOff, int yOff) { CustomTuple <int, int> result = new CustomTuple <int, int>(position.x + xOff, position.y + yOff); if (CellIsInGroup(result)) { return(result); } return(null); }
/// <summary> /// Used to randomly scramble a list of elements /// </summary> /// <param name="target">The list to be scrambled</param> private void ScrambleList(List <CustomTuple <int, int> > target) { for (int i = 0; i < target.Count; i++) { int randIndex = UnityEngine.Random.Range(0, target.Count); CustomTuple <int, int> temp = target[i]; target[i] = target[randIndex]; target[randIndex] = temp; } }
public void RemoveSelected(GameObject row) { if (row) { CustomTuple temp = refData.PopFromRefList(row.name); GetComponent <ReferenceCalculator>().ClearLine(temp.GetFirst(), temp.GetSecond()); GetComponent <ReferenceCalculator>().ClearCalculationsText(temp.GetFirst(), temp.GetSecond()); ViewAllPanel.GetComponent <PopulateAirRef>().Populate(); } }
public override CustomTuple GetNext() { CustomTuple tuple = Left.GetNext(); if (tuple != null) { return(tuple.Projection(_projectionColumns)); } return(null); }
private bool RefListContains(CustomTuple temp) { foreach (CustomTuple child in AircraftReferences) { if (child.GetUniqueName() == temp.GetUniqueName()) { return(true); } } return(false); }
public CustomTuple verificatioResult(CustomTuple _actions, CustomTuple _tuple) { CustomTuple _result = new CustomTuple(); for (int i = 0; i < _actions.getSize(); i++) { CustomAction _action = (CustomAction)_actions.getElement(i); _result.add(verificatioResult(_action, _tuple)); } return(_result); }
public override CustomTuple GetNext() { CustomTuple tuple = Left.GetNext(); if (tuple != null) { Table.Insert(tuple); } return(tuple); }
public bool CellIsInGroup(CustomTuple <int, int> pos) { bool xInRange = pos.x >= position.x && pos.x <= final.x; bool yInRange = pos.y >= position.y && pos.y <= final.y; if (xInRange && yInRange) { return(true); } return(false); }
public bool SetSize(CustomTuple <int, int> s) { if (s.x > 0 && s.y > 0) { size = new CustomTuple <int, int>(s.x, s.y); CalculateFinal(); return(true); } return(false); }
public override CustomTuple GetNext() { CustomTuple tuple = Left.GetNext(); if (tuple != null && _returned < _amount) { _returned++; return(tuple); } return(null); }
public override CustomTuple GetNext() { if (Set.Count > _currentIndex) { CustomTuple tuple = Set[_currentIndex]; _currentIndex++; return(tuple); } return(null); }
public bool MoveNext() { if (LeftToRight) { CurrentValue = CurrentNode?.Values.Count > _i ? CurrentNode.Values[_i] : null; } else { CurrentValue = _i >= 0 ? CurrentNode.Values[_i] : null; } if (CurrentValue == null) { if ((LeftToRight && CurrentNode?.RightSibling != null) || (!LeftToRight && CurrentNode?.LeftSibling != null)) { CurrentNode = LeftToRight ? CurrentNode.RightSibling : CurrentNode.LeftSibling; if (LeftToRight) { _i = 0; } else { _i = CurrentNode.Values.Count - 1; } CurrentValue = CurrentNode.Values.Count >= _i ? CurrentNode.Values[_i] : null; } } if (LeftToRight) { _i++; } else { _i--; } if (CurrentValue != null && Condition != null) { CustomTuple tuple = new CustomTuple(Relation); tuple.AddValueFor(Condition.Column.Name, (int)CurrentValue.Value); if (!Condition.SatisfiesCondition(tuple)) { return(MoveNext()); } } return(CurrentValue != null); }
public Boolean isValidDataConstraint(DataConstraint constraints) { CustomTuple stDataSet = constraints.constraintStandards.standards; if (!constraintStandards.isPassStandard(stDataSet)) { return(false); } else { return(true); } }
public Boolean isValidRelation(CustomTuple _tuple, CustomTuple _actions, Standard _standards) { CustomTuple _result = verificationResult(_actions, _tuple); if (standards.isPassStandard(_result)) { return(true); } else { return(false); } }
protected override void UpdateSense() { if (this.RaycastDistances.IsNullOrEmpty() || this.RaycastDistances.Length != this.nrOfRays) { this.RaycastDistances = new CustomTuple <float, Collider> [this.nrOfRays]; for (var i = 0; i < this.RaycastDistances.Length; i++) { this.RaycastDistances[i] = CustomTuple.Create <float, Collider>(-1f, null); } this._raycastColors = new Color[this.nrOfRays]; } Utils.FovAction(this.transform.up, this.transform.forward, this.nrOfRays, this.fov, this.RaycastAction); }
public void AddToRefList(GameObject air1, GameObject air2) { CustomTuple temp = new CustomTuple(); temp.SetFirst(air1); temp.SetSecond(air2); temp.SetUniqueName(air1.name + air2.name); temp.SetDisplayName(air1.gameObject.GetComponent <movement>().getCallSign() + " ---- " + air2.gameObject.GetComponent <movement>().getCallSign()); if (!RefListContains(temp)) { AircraftReferences.Add(temp); } }
public CustomTuple PopFromRefList(string rowName) { CustomTuple popObject = null; foreach (CustomTuple child in AircraftReferences) { if (child.GetUniqueName() == rowName) { popObject = child; AircraftReferences.Remove(child); break; } } return(popObject); }
static void Main() { var firstLine = Console.ReadLine().Split(); var secondLine = Console.ReadLine().Split(); var thirdLine = Console.ReadLine().Split(); var firstTuple = new CustomTuple <string, string>(string.Join(" ", firstLine[0], firstLine[1]), firstLine[2]); var secondTuple = new CustomTuple <string, int>(secondLine[0], int.Parse(secondLine[1])); var thirdTuple = new CustomTuple <int, double>(int.Parse(thirdLine[0]), double.Parse(thirdLine[1])); Console.WriteLine(firstTuple); Console.WriteLine(secondTuple); Console.WriteLine(thirdTuple); }
public override CustomTuple GetNext() { CustomTuple tuple = Left.GetNext(); if (tuple != null) { if (Condition.SatisfiesCondition(tuple)) { return(tuple); } return(GetNext()); } return(null); }
private void CalculateFinal() { if (final == null) { final = new CustomTuple <int, int>(0, 0); } if (size == null) { size = new CustomTuple <int, int>(1, 1); } if (position == null) { position = new CustomTuple <int, int>(0, 0); } final.x = position.x + size.x - 1; final.y = position.y + size.y - 1; }
public static void Main() { string[] firstLine = Console.ReadLine().Split(); string[] secondLine = Console.ReadLine().Split(); string[] thirdLine = Console.ReadLine().Split(); CustomTuple <string, string, string> firstTuple = new CustomTuple <string, string, string>( firstLine[0] + " " + firstLine[1], firstLine[2], firstLine[3]); CustomTuple <string, int, string> secondTuple = new CustomTuple <string, int, string>( secondLine[0], int.Parse(secondLine[1]), (secondLine[2] == "drunk") ? "True" : "False"); CustomTuple <string, double, string> thirdTuple = new CustomTuple <string, double, string>( thirdLine[0], double.Parse(thirdLine[1]), thirdLine[2]); Console.WriteLine(firstTuple); Console.WriteLine(secondTuple); Console.WriteLine(thirdTuple); }
/// <summary> /// Used to determine the usable area and fill in the possible start and end point arrays /// </summary> private void CalculateUsableAreaValues() { int maxX = numHorizontalCells - (currentPathWidth + mapBorderWidth + 1); int maxY = numVerticalCells - (currentPathWidth + mapBorderWidth + 1); usableAreaBotLeft = new CustomTuple <int, int>(mapBorderWidth + 1, mapBorderWidth + 1); usableAreaTopRight = new CustomTuple <int, int>(maxX, maxY); possibleStarts = new CustomTuple <int, int> [4]; possibleEnds = new CustomTuple <int, int> [4]; possibleStarts[BOTTOM_CORNER] = new CustomTuple <int, int>(usableAreaBotLeft.x, usableAreaBotLeft.y); possibleStarts[SIDE] = new CustomTuple <int, int>(usableAreaBotLeft.x, (usableAreaBotLeft.y + usableAreaTopRight.y) / 2); possibleStarts[TOP_CORNER] = new CustomTuple <int, int>(usableAreaBotLeft.x, usableAreaTopRight.y); possibleStarts[MIDDLE] = new CustomTuple <int, int>((usableAreaBotLeft.x + usableAreaTopRight.x) / 2, usableAreaBotLeft.y); possibleEnds[BOTTOM_CORNER] = new CustomTuple <int, int>(usableAreaTopRight.x, usableAreaBotLeft.y); possibleEnds[SIDE] = new CustomTuple <int, int>(usableAreaTopRight.x, (usableAreaBotLeft.y + usableAreaTopRight.y) / 2); possibleEnds[TOP_CORNER] = new CustomTuple <int, int>(usableAreaTopRight.x, usableAreaTopRight.y); possibleEnds[MIDDLE] = new CustomTuple <int, int>((usableAreaBotLeft.x + usableAreaTopRight.x) / 2, usableAreaTopRight.y); }
public override CustomTuple GetNext() { _recordIndex++; if (_currentBlock.GetSortedRecords().Count() <= _recordIndex) { if (_currentBlock.NextBlock != null) { _currentBlock = _currentBlock.NextBlock; _recordIndex = 0; } else { return(null); } } _currentTuple = new CustomTuple(Table.TableDefinition).FromRecord(_currentBlock.GetSortedRecords()[_recordIndex]); return(_currentTuple); }