Beispiel #1
0
 public static void ShowResult(Size size, Sock sock)
 {
     Console.WriteLine("So. The size is {0}-{1}. You need to start with {2} loops altogether. \n" +
                       "Add the loops until you have {3} on each needle. \n" +
                       "Work {4} rows until you start the heel. \n" +
                       "Make a heel with {5} loops on each side. \n" +
                       "Work {6} rows for calf. Add {7} loops on each needle. Work {8} rows for elasticRows.\n" +
                       "Use a {9} marker. " +
                       "Good luck!",
                       size.shoe1, size.shoe2,
                       sock.start, sock.oneNeedle, sock.length, sock.heel, sock.calf, sock.elasticLoopsToAddOnNeedle, sock.elasticRows,
                       size.marker
                       );
 }
Beispiel #2
0
        public static Sock DoTheMath(Size size, Sample sample)
        {
            Coefficients myCoefficients = new Coefficients(sample);

            //how long and wide should the knitted foot be
            var sockLengthMm   = size.footLength / myCoefficients.KHeight();
            var sockDiameterMm = size.footDiameter / myCoefficients.KWidth();

            //TODO: better converter
            var sockDiameterLoops = (int)System.Math.Round(Converters.MillimetersToLoops(sockDiameterMm, sample.width, sample.loops), 0);

            sockDiameterLoops = Converters.MakeItFour(sockDiameterLoops);

            int oneNeedle = sockDiameterLoops / 4;
            int start     = Converters.MakeItFour(oneNeedle * 2);
            //int start = oneNeedle * 2;

            //how many footRows do toes and heelHeightRows take
            int heelRows = (int)System.Math.Round((double)oneNeedle * 2 / 3, 0);

            var toesAndHeelRows = CountToes(start / 4, oneNeedle) + heelRows;
            var toesAndHeelMm   = Converters.RowsToMillimeters(toesAndHeelRows, sample.height, sample.rows);

            //how many millimeters should you knit between toes and heelHeightRows and how many footRows does it take
            var sockLengthStraightMm   = sockLengthMm - toesAndHeelMm;
            var sockLengthStraightRows = Converters.MillimetersToRows(sockLengthStraightMm, sample.height, sample.rows);

            int length = Convert.ToInt32(sockLengthStraightRows);

            //how high should the calf be
            //TODO: better converter
            int calf = (int)CountCalf(sockLengthStraightRows);

            (int rows, int add)elastic = CountElastic(size, calf, oneNeedle);
            var sock = new Sock(length, start, heelRows, calf, elastic.rows, elastic.add, oneNeedle);

            return(sock);
        }