예제 #1
0
        private void OutputGpio(Pin pin, HighLow value, long duration = -1)
        {
            PosixUtils.Echo(pin.ValueWriter, value == HighLow.High ? "1" : "0");

            if (duration != -1)
            {
                operatingSystemService.NanoSleep(duration);
            }
        }
예제 #2
0
    public static void Main()
    {
        HighLow newGame = new HighLow();

        newGame.WhichGame();
        Console.WriteLine("Play Again? (Y/N)");
        string again = Console.ReadLine();

        if (again == "Y")
        {
            Main();
        }
    }
예제 #3
0
    public static void Main()
    {
        Console.WriteLine("Would you like to play the Higher/Lower game? (Yes/No)");
        string choice = Console.ReadLine();

        while (choice == "Yes")
        {
            HighLow gameTime = new HighLow(100, 0);
            Console.WriteLine("Okay");
            gameTime.Guessing();
            Console.WriteLine("Great! I guessed your number.  Would you like to play again? (Yes/No)");
            choice = Console.ReadLine();
        }
    }
예제 #4
0
        public unsafe void Output(int pin, HighLow value, long duration = -1)
        {
            // calculate offset
            var offset =
                value == HighLow.High
                    ? SET_OFFSET + (pin / 32)
                    : CLR_OFFSET + (pin / 32);

            // get unsafe base map pointer
            var basePtr = (int *)gpioMap;

            // write value to memory at (base + offset)
            *(basePtr + offset) = 1 << (pin % 32);

            if (duration != -1)
            {
                operatingSystemService.NanoSleep(duration);
            }
        }
예제 #5
0
        public HighLowChart(ChartView BaseChart)
        {
            highLow = new HighLow();
            var     = new Variables.Variables();
            highLow.FillSampleValues(25);
            BaseChart.Chart.Series.Add(highLow);

            highLow.Color = var.GetPaletteBasic[0];

            BaseChart.Chart.Axes.Left.AxisPen.Visible   = true;
            BaseChart.Chart.Axes.Left.Visible           = true;
            BaseChart.Chart.Axes.Bottom.Visible         = true;
            BaseChart.Chart.Axes.Left.AxisPen.Visible   = true;
            BaseChart.Chart.Axes.Bottom.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Visible           = true;
            BaseChart.Chart.Axes.Bottom.Visible         = true;
            BaseChart.Chart.Axes.Left.Grid.Visible      = true;

            BaseChart.Chart.Legend.Visible = false;
            BaseChart.Chart.Title.Text     = "HighLow series";

            BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue, BaseChart.Chart.Axes.Left.MaxYValue);
            BaseChart.Chart.Axes.Bottom.SetMinMax(BaseChart.Chart.Axes.Bottom.MinXValue, BaseChart.Chart.Axes.Bottom.MaxXValue);
        }
예제 #6
0
        internal Payout DeterminePayoutForLowHigh(Slot slot, HighLow betchoice)
        {
            int.TryParse(slot.SlotNumber, out int slotNumber);

            switch (slotNumber)
            {
            case int n when((n >= 1 && n <= 18) && betchoice == HighLow.Low):
                return(new Payout
                {
                    PayOff = 2, Amount = _betAmount * 2
                });

            case int n when((n >= 19 && n <= 36) && betchoice == HighLow.High):
                return(new Payout
                {
                    PayOff = 2, Amount = _betAmount * 2
                });

            default:
                return(new Payout {
                    Amount = 0
                });
            }
        }
예제 #7
0
 public Task OutputAsync(int pin, HighLow value, long duration = -1)
 {
     throw new NotImplementedException();
 }
예제 #8
0
 public void Output(int pin, HighLow value, long duration = -1)
 {
     textWriter.WriteLine("Output pin {0} Value {1} Duration {2}", pin, value, duration);
 }
예제 #9
0
 public HighLowBets(double amount, HighLow highLow) : base(amount, 1)
 {
     _highLow = highLow;
 }
예제 #10
0
        private void ChartToCreate(String item)
        {
            List <String[]> originalData = ChartData();

            String[] dataPicker = new String[originalData.Count];

            for (int i = 0; i < originalData.Count; i++)
            {
                dataPicker[i] = originalData[i][1];
            }
            _customChart.ChartView.Chart.Series.RemoveAllSeries();

            var imageButton = ((((this.Children[0] as ContentPage).Content as ScrollView).Content as StackLayout).Children[1] as Grid).Children[2] as Button;

            switch (item)
            {
            case "AREA":
                Area area = new Area();
                area.FillSampleValues(3);
                _customChart.ChartView.Chart.Series.Add(area);
                _customChart.ImageSource = dataPicker[0];
                imageButton.ImageSource  = dataPicker[0];

                break;

                    #if !TEE_STD
            case "ARROW":
                Arrow arrow = new Arrow();
                arrow.FillSampleValues(10);
                _customChart.ChartView.Chart.Series.Add(arrow);
                _customChart.ImageSource = dataPicker[1];
                imageButton.ImageSource  = dataPicker[1];
                break;
#endif

            case "BAR":
                Bar bar = new Bar();
                bar.FillSampleValues(4);
                _customChart.ChartView.Chart.Series.Add(bar);
                _customChart.ImageSource = dataPicker[2];
                imageButton.ImageSource  = dataPicker[2];
                break;

                    #if !TEE_STD
            case "BARJOIN":
                BarJoin barjoin = new BarJoin();
                barjoin.FillSampleValues(5);
                _customChart.ChartView.Chart.Series.Add(barjoin);
                _customChart.ImageSource = dataPicker[3];
                imageButton.ImageSource  = dataPicker[3];
                break;

            case "BEZIER":
                Bezier bezier = new Bezier();
                bezier.FillSampleValues(5);
                _customChart.ChartView.Chart.Series.Add(bezier);
                _customChart.ImageSource = dataPicker[4];
                imageButton.ImageSource  = dataPicker[4];
                break;

            case "BOX":
                Box box = new Box();
                box.FillSampleValues(3);
                _customChart.ChartView.Chart.Series.Add(box);
                _customChart.ImageSource = dataPicker[5];
                imageButton.ImageSource  = dataPicker[5];
                break;
#endif
            case "BUBBLES":
                Bubble bubble = new Bubble();
                bubble.FillSampleValues(7);
                _customChart.ChartView.Chart.Series.Add(bubble);
                _customChart.ImageSource = dataPicker[6];
                imageButton.ImageSource  = dataPicker[6];
                break;

                    #if !TEE_STD
            case "CANDLE":
                Candle candle = new Candle();
                candle.FillSampleValues(5);
                _customChart.ChartView.Chart.Series.Add(candle);
                _customChart.ImageSource = dataPicker[7];
                imageButton.ImageSource  = dataPicker[7];
                break;

            case "CONTOUR":
                Contour countour = new Contour();
                countour.FillSampleValues(1);
                _customChart.ChartView.Chart.Series.Add(countour);
                _customChart.ImageSource = dataPicker[8];
                imageButton.ImageSource  = dataPicker[8];
                break;

            case "DARVAS":
                Darvas darvas = new Darvas();
                darvas.FillSampleValues(3);
                _customChart.ChartView.Chart.Series.Add(darvas);
                _customChart.ImageSource = dataPicker[9];
                imageButton.ImageSource  = dataPicker[9];
                break;
#endif
            case "DONUT":
                Donut donut = new Donut();
                donut.FillSampleValues(1);
                _customChart.ChartView.Chart.Series.Add(donut);
                _customChart.ImageSource = dataPicker[10];
                imageButton.ImageSource  = dataPicker[10];
                break;

                    #if !TEE_STD
            case "ERROR":
                Error error = new Error();
                error.FillSampleValues(5);
                _customChart.ChartView.Chart.Series.Add(error);
                _customChart.ImageSource = dataPicker[11];
                imageButton.ImageSource  = dataPicker[11];
                break;

            case "ERRORBAR":
                ErrorBar errorbar = new ErrorBar();
                errorbar.FillSampleValues(5);
                _customChart.ChartView.Chart.Series.Add(errorbar);
                _customChart.ImageSource = dataPicker[12];
                imageButton.ImageSource  = dataPicker[12];
                break;

            case "ERRORPOINT":
                ErrorPoint errorPoint = new ErrorPoint();
                errorPoint.FillSampleValues(7);
                _customChart.ChartView.Chart.Series.Add(errorPoint);
                _customChart.ImageSource = dataPicker[13];
                imageButton.ImageSource  = dataPicker[13];
                break;
#endif
            case "FASTLINE":
                FastLine fastLine = new FastLine();
                fastLine.FillSampleValues(2);
                _customChart.ChartView.Chart.Series.Add(fastLine);
                _customChart.ImageSource = dataPicker[14];
                imageButton.ImageSource  = dataPicker[14];
                break;

                    #if !TEE_STD
            case "HIGHLOW":
                HighLow highLow = new HighLow();
                highLow.FillSampleValues(4);
                _customChart.ChartView.Chart.Series.Add(highLow);
                _customChart.ImageSource = dataPicker[15];
                imageButton.ImageSource  = dataPicker[15];
                break;

            case "HISTOGRAM":
                Histogram histogram = new Histogram();
                histogram.FillSampleValues(6);
                _customChart.ChartView.Chart.Series.Add(histogram);
                _customChart.ImageSource = dataPicker[16];
                imageButton.ImageSource  = dataPicker[16];
                break;
#endif
            case "HORIZAREA":
                HorizArea horizArea = new HorizArea();
                horizArea.FillSampleValues(6);
                _customChart.ChartView.Chart.Series.Add(horizArea);
                _customChart.ImageSource = dataPicker[17];
                imageButton.ImageSource  = dataPicker[17];
                break;

            case "HORIZBAR":
                HorizBar horizBar = new HorizBar();
                horizBar.FillSampleValues(6);
                _customChart.ChartView.Chart.Series.Add(horizBar);
                _customChart.ImageSource = dataPicker[18];
                imageButton.ImageSource  = dataPicker[18];
                break;

            case "HORIZLINE":
                HorizLine horizLine = new HorizLine();
                horizLine.FillSampleValues(6);
                _customChart.ChartView.Chart.Series.Add(horizLine);
                _customChart.ImageSource = dataPicker[19];
                imageButton.ImageSource  = dataPicker[19];
                break;

                    #if !TEE_STD
            case "ISOSURFACE":
                IsoSurface isoSurface = new IsoSurface();
                isoSurface.FillSampleValues(10);
                _customChart.ChartView.Chart.Series.Add(isoSurface);
                _customChart.ImageSource = dataPicker[20];
                imageButton.ImageSource  = dataPicker[20];
                break;
#endif
            case "LINE":
                Line line = new Line();
                line.FillSampleValues(5);
                _customChart.ChartView.Chart.Series.Add(line);
                _customChart.ImageSource = dataPicker[21];
                imageButton.ImageSource  = dataPicker[21];
                break;

#if !TEE_STD
            case "LINEPOINT":
                LinePoint linePoint = new LinePoint();
                linePoint.FillSampleValues(6);
                _customChart.ChartView.Chart.Series.Add(linePoint);
                _customChart.ImageSource = dataPicker[22];
                imageButton.ImageSource  = dataPicker[22];
                break;
#endif
            case "PIE":
                Pie pie = new Pie();
                pie.FillSampleValues(4);
                _customChart.ChartView.Chart.Series.Add(pie);
                _customChart.ImageSource = dataPicker[23];
                imageButton.ImageSource  = dataPicker[23];
                break;

#if !TEE_STD
            case "SURFACE":
                Surface surface = new Surface();
                surface.FillSampleValues(10);
                //surface.
                _customChart.ChartView.Chart.Series.Add(surface);
                _customChart.ImageSource = dataPicker[24];
                imageButton.ImageSource  = dataPicker[24];
                break;

            case "TOWER":
                Tower tower = new Tower();
                tower.FillSampleValues(8);
                _customChart.ChartView.Chart.Series.Add(tower);
                _customChart.ImageSource = dataPicker[25];
                imageButton.ImageSource  = dataPicker[25];
                break;

            case "VOLUME":
                Volume volume = new Volume();
                volume.FillSampleValues(9);
                _customChart.ChartView.Chart.Series.Add(volume);
                _customChart.ImageSource = dataPicker[26];
                imageButton.ImageSource  = dataPicker[26];
                break;
#endif
            }

            _customChart.ChartView.Chart.Axes.Left.Automatic   = true;
            _customChart.ChartView.Chart.Axes.Bottom.Automatic = true;
        }
예제 #11
0
        /// <summary>
        /// Shows the Historigram Chart from Maximum Temperature forecast.
        /// </summary>
        /// <param name="weather"> Weather info</param>
        private void MaxTemperatureForecast(ActualWeather weather)
        {
            var tChart1 = new Chart();

            tChart1.Aspect.View3D                     = false;
            tChart1.Legend.Visible                    = false;
            tChart1.Axes.Bottom.Labels.Angle          = 90;
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "dd/MMM";
            tChart1.Header.Text = "Min/Max Temperature of " + App.Weather.Name;
            var maxTemp = new Histogram(tChart1.Chart);
            var highlow = new HighLow(tChart1.Chart);

            //maxTemp.LinesPen.Visible = false;
            maxTemp.Color                   = Color.FromRgb(27, 177, 255);
            maxTemp.LinePen.Color           = Color.FromRgb(27, 177, 255);
            maxTemp.LinePen.Width           = 20;
            maxTemp.LinesPen.Width          = 20;
            maxTemp.LinesPen.Visible        = true;
            maxTemp.LinePen.Visible         = true;
            maxTemp.LinesPen.Color          = Color.FromRgb(27, 177, 255);
            highlow.HighPen.Width           = 4;
            highlow.LowPen.Width            = 4;
            highlow.HighPen.DashCap         = Steema.TeeChart.Drawing.PenLineCap.Round;
            highlow.HighPen.EndCap          = Steema.TeeChart.Drawing.PenLineCap.Round;
            highlow.HighPen.Style           = Steema.TeeChart.Drawing.DashStyle.Solid;
            highlow.LowPen.DashCap          = Steema.TeeChart.Drawing.PenLineCap.Round;
            highlow.LowPen.EndCap           = Steema.TeeChart.Drawing.PenLineCap.Round;
            highlow.LowPen.Style            = Steema.TeeChart.Drawing.DashStyle.Solid;
            highlow.Marks.Visible           = true;
            highlow.Marks.DrawEvery         = 3;
            highlow.Marks.FollowSeriesColor = true;
            highlow.HighPen.Color           = Color.FromRgb(223, 5, 0);
            highlow.LowPen.Color            = Color.FromRgb(240, 186, 0);
            highlow.Pen.Visible             = false;

            double max = App.getDegScaleTemp(weather.LstWeather[0].MaxTemperature);
            double min = App.getDegScaleTemp(weather.LstWeather[0].MaxTemperature);

            foreach (var item in weather.LstWeather)
            {
                if (App.getDegScaleTemp(item.MaxTemperature) > max)
                {
                    max = App.getDegScaleTemp(item.MaxTemperature);
                }
                if (App.getDegScaleTemp(item.MaxTemperature) < min)
                {
                    min = App.getDegScaleTemp(item.MinTemperature);
                }
                maxTemp.Add(item.Date, App.getDegScaleTemp(item.MaxTemperature));
                highlow.Add(maxTemp.XValues.Last, item.MaxTemperature, item.MinTemperature);
            }
            maxTemp.Marks.AutoPosition = true;
            maxTemp.Marks.Transparent  = true;
            tChart1.Axes.Left.SetMinMax((int)min - 3, (int)max + 4);

            tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneDay);
            tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.MinXValue + 0.5, tChart1.Axes.Bottom.MaxXValue - 0.5);
            AxisSettings(tChart1);
            TitleSettings(tChart1);
            //SeriesMarksSettings(maxTemp);
            tChart1.Axes.Left.Increment = 4;

            ShowChart(tChart1);
        }
예제 #12
0
        private void createHistogram(StringBuilder report, WeatherDataCollection tempWeatherCollection, int lowerBound, int upperBound, int bucketSize, HighLow highOrLow)
        {
            var initialTierLowerBound = lowerBound - (lowerBound % bucketSize);
            int initialOffset         = 1;
            var initialTierUpperBound = initialTierLowerBound + bucketSize - initialOffset;
            var highestTierOffset     = bucketSize - 1;
            var finalTierUpperBound   = upperBound - upperBound % bucketSize + highestTierOffset;

            while (initialTierLowerBound <= finalTierUpperBound)
            {
                int countOfDays;
                if (highOrLow.Equals(HighLow.High))
                {
                    countOfDays = tempWeatherCollection.CountDaysWithHighBetween(initialTierLowerBound, initialTierUpperBound);
                }
                else
                {
                    countOfDays = tempWeatherCollection.CountDaysWithLowBetween(initialTierLowerBound, initialTierUpperBound);
                }
                report.Append(
                    $"{initialTierLowerBound}-{initialTierUpperBound}: {countOfDays} {Environment.NewLine}");
                initialTierLowerBound = initialTierLowerBound + bucketSize;
                initialTierUpperBound = initialTierUpperBound + bucketSize;
            }
        }
예제 #13
0
 public async Task OutputAsync(int pin, HighLow value, long duration = -1)
 {
     Output(pin, value, duration);
 }
예제 #14
0
        public void Output(int pin, HighLow value, long duration = -1)
        {
            var pinObj = pins[pin];

            OutputGpio(pinObj, value);
        }