/// <summary>
        /// This methods was taken from the exercice level 1 GetMessage. And use a BaseTool method.
        /// TODO: search for a best matrix value solver.
        /// </summary>
        /// <param name="receivedMessages"></param>
        /// <returns></returns>
        public string GetMessage(List <List <string> > receivedMessages)
        {
            string retVal = "";

            //first check consistency of the received Messages.
            CheckReceivedMessagesConsistency(receivedMessages);

            //Get the final Message from the Matrix of words
            retVal = BaseTools.GetStringFromStringMatrix(receivedMessages);

            return(retVal);
        }
Esempio n. 2
0
        /// <summary>
        /// This methods was taken from the exercice level 1 GetLocation. And use a BaseTool method named TrilaterationSolver.
        /// TODO: search for a best Trilateration Algorithm.
        /// </summary>
        /// <param name="allSatellites"></param>
        /// <returns></returns>
        public XYCoordinates GetLocation(AllSatellitesData allSatellites)  //I took this function from exercice Level 1 but I extend it passing more information in its parameter.
        {
            //At the moment it is only calling this BaseTools methods, but it could be an interface to a generic calls with diferents implementations and parameters.
            XYCoordinates xYCoordinates = BaseTools.TrilaterationSolver(_rebelSatellites.rebelSatellitesPositionList[allSatellites.satellites[0].name],
                                                                        allSatellites.satellites[0].distance,
                                                                        _rebelSatellites.rebelSatellitesPositionList[allSatellites.satellites[1].name],
                                                                        allSatellites.satellites[1].distance,
                                                                        _rebelSatellites.rebelSatellitesPositionList[allSatellites.satellites[2].name],
                                                                        allSatellites.satellites[2].distance);

            //reformat GetLocation asnwer to match exercice reuirements. Just 1 decimal number.
            xYCoordinates.xCoord = (float)Math.Round(xYCoordinates.GetCoordinateX(), 1);
            xYCoordinates.yCoord = (float)Math.Round(xYCoordinates.GetCoordinateY(), 1);
            return(xYCoordinates);
        }