示例#1
0
    // Создание случайного мелка
    Chalk RandomChalk(Chalk previous)
    {
        float x = Random.Range(-2.0f, 2.0f);
        float y = previous.PosY + Random.Range(2.5f, 5.0f);

        Chalk result;
        float random = Random.Range(0.0f, 81.0f);

        if (random < 70)
        {
            result = new SimpleChalk(x, y);
        }
        else if (random >= 70 && random < 75)
        {
            result = new RedChalk(x, y);
        }
        else if (random >= 76 && random < 79)
        {
            result = new GreenChalk(x, y);
        }
        else
        {
            result = new VioletChalk(x, y);
        }

        return(result);
    }
示例#2
0
        public override int GetHashCode()
        {
            int hashCode = -1002186340;

            hashCode = hashCode * -1521134295 + LabBookId.GetHashCode();
            hashCode = hashCode * -1521134295 + Solid.GetHashCode();
            hashCode = hashCode * -1521134295 + Ash450.GetHashCode();
            hashCode = hashCode * -1521134295 + Ash900.GetHashCode();
            hashCode = hashCode * -1521134295 + Organic.GetHashCode();
            hashCode = hashCode * -1521134295 + Titanium.GetHashCode();
            hashCode = hashCode * -1521134295 + Chalk.GetHashCode();
            hashCode = hashCode * -1521134295 + Others.GetHashCode();
            hashCode = hashCode * -1521134295 + VocCatId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(VocAmount);

            hashCode = hashCode * -1521134295 + Crucible1.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible2.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible3.GetHashCode();
            hashCode = hashCode * -1521134295 + Paint1.GetHashCode();
            hashCode = hashCode * -1521134295 + Paint2.GetHashCode();
            hashCode = hashCode * -1521134295 + Paint3.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible105_1.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible105_2.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible105_3.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible405_1.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible405_2.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible405_3.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible900_1.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible900_2.GetHashCode();
            hashCode = hashCode * -1521134295 + Crucible900_3.GetHashCode();
            hashCode = hashCode * -1521134295 + Created.GetHashCode();
            hashCode = hashCode * -1521134295 + Updated.GetHashCode();
            return(hashCode);
        }
示例#3
0
 private static void PrintBasicCLI()
 {
     Console.Clear();
     Chalk.BlueLine("\t\t\tSudoku Multi Solver");
     Chalk.White("\n");
     Sudoku.PrettyPrint();
 }
示例#4
0
        public void PrettyPrint()
        {
            //Local function to print either a point or the value
            string printCell(int i, int j)
            {
                if (Board[i, j] == 0)
                {
                    return("·");
                }

                return(Board[i, j].ToString());
            }

            for (var i = 0; i < Board.GetLength(0); i++)
            {
                if (i % 3 == 0)
                {
                    Chalk.BlueLine("\t\t+---------+---------+---------+");
                }

                Chalk.Blue("\t\t|");
                for (var j = 0; j < Board.GetLength(1); j += 3)
                {
                    Chalk.White($" {printCell(i, j)} ");
                    Chalk.White($" {printCell(i, j+1)} ");
                    Chalk.White($" {printCell(i, j+2)} ");
                    Chalk.Blue("|");
                }
                Chalk.WhiteLine("");
            }
            Chalk.BlueLine("\t\t+---------+---------+---------+");
        }
示例#5
0
 private static void Main(string[] args)
 {
     Chalk.Red(string.Format("asdf{0}", "ludmal"));
     Chalk.Blue("blue");
     Chalk.Green("green");
     Chalk.Yellow("yellow");
     Chalk.Gray("gray");
 }
示例#6
0
        private static ICommand ReadCommand()
        {
            Chalk.White(">>");
            var line    = Console.ReadLine();
            var command = parser.ParseCommand(line);

            return(command);
        }
示例#7
0
        public void Execute()
        {
            Chalk.YellowLine("Generating...");
            var board = generator.Generate().Result;

            Chalk.YellowLine("Done");
            CLI.Sudoku.Board = board;
            Chalk.YellowLine("Press enter again to refresh the board (Yeah, I know....)");
        }
示例#8
0
 // Отслеживание пересечений с мелками
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Chalk")
     {
         aud.PlayOneShot(Resources.Load <AudioClip>("Sounds/chalk"));
         string       name   = collision.name;
         ObjectHandle handle = Activator.CreateInstance("Assembly-CSharp", name);
         Chalk        chalk  = (Chalk)handle.Unwrap();
         Game.AddPoints(chalk.Points);
         Destroy(chalk.Exemplar);
         Destroy(collision);
         collision.GetComponent <SpriteRenderer>().enabled = false;
     }
 }
示例#9
0
 public static void Run()
 {
     try
     {
         Chalk.BlueLine("Welcome to the Sudoku Solver CLI. Type 'help' or '?' to display available commands.");
         //Todo remove this
         SetSolver(new BasicBacktrackSolver());
         LifeCycle();
     }
     catch (Exception e)
     {
         Chalk.RedLine(e.Message);
     }
 }
示例#10
0
文件: Program.cs 项目: ludmal/AWS.Net
        private static void Main(string[] args)
        {
            var service = new SqsService <EmailMessage>(new AwsCredentials
            {
                RegionEndpoint = RegionEndpoint.USWest2
            });

            service.QueueUrl = ConfigurationManager.AppSettings["EmailQueue"];

            var response = service.Push(new HelloEmail());

            Chalk.Green(string.Format("Message {0} send successfully", response.MessageId));


            while (true)
            {
                var items = service.Process();
                Chalk.Green(items.Select(x => x.Subject).ToString());
                System.Threading.Thread.Sleep(3000);
            }
        }
示例#11
0
        private static void threadmethod()
        {
            Chalk  chalk  = new Chalk(Canvainfo.handPtr, Canvainfo.height, Canvainfo.width, new Color4(0f, 0f, 0f));
            Eraser eraser = new Eraser(Canvainfo.handPtr, Canvainfo.height, Canvainfo.width, new Color4(0f, 0f, 0f));
            Sweep  sweep  = new Sweep(Canvainfo.handPtr, Canvainfo.height, Canvainfo.width, new Color4(0f, 0f, 0f));

            while (true)
            {
                if (Pointtrace.Flag == 1)
                {
                    switch (Tooltype.type)
                    {
                    case 1: chalk.Render(Pointtrace.GetAllPoint(), Pointtrace.GetPointlist()); break;

                    case 2: eraser.Render(Pointtrace.GetAllPoint(), Pointtrace.GetPointlist()); break;

                    case 3: sweep.Render(Pointtrace.GetAllPoint(), Pointtrace.GetPointlist()); break;
                    }
                }
                Thread.Sleep(1);
            }
        }
示例#12
0
 public void Execute()
 {
     Chalk.RedLine($"sudoku multi solver: command not found: {attemptedCommand}");
 }
示例#13
0
    Picture pictBottom;                     // самая нижеяя картинка

    void Awake()
    {
        platforms = new Dictionary <sbyte, Platform>();
        bgs       = new Dictionary <sbyte, Bg>();
        chalks    = new Dictionary <sbyte, Chalk>();
        pictures  = new Dictionary <sbyte, Picture>();

        chalksCount = 25;
        height      = 0;
        record      = LoadOldRecord();

        // Добавление начальных 10 платформ
        bottom = new Simple();
        platforms.Add(0, bottom);

        for (sbyte i = 1; i < 10; i++)
        {
            Platform previous;
            platforms.TryGetValue((sbyte)(i - 1), out previous);
            platforms.Add(i, RandomPlatform(previous));
        }

        // Добавление 3 фоновых спрайтов
        bgBottom = new Bg(-BGHeight()); //Первый фон находится на высоту фонового спрайта ниже игрока
        bgs.Add(0, bgBottom);

        for (sbyte i = 1; i < 3; i++)
        {
            Bg bgPrevious;
            bgs.TryGetValue((sbyte)(i - 1), out bgPrevious);
            bgs.Add(i, new Bg(bgPrevious.Obj.transform.position.y + BGHeight()));
            if (!bgPrevious.Obj.GetComponent <SpriteRenderer>().flipY)
            {
                Bg bgTemp;
                bgs.TryGetValue(i, out bgTemp);
                bgTemp.Obj.GetComponent <SpriteRenderer>().flipY = true;
            }
        }

        // Добавление мелков
        chalkBottom = RandomChalk(new SimpleChalk(Random.Range(-2.0f, 2.0f), Random.Range(1.0f, 3.0f)));
        chalks.Add(0, chalkBottom);

        for (sbyte i = 1; i < 5; i++)
        {
            Chalk chalkPrevious;
            chalks.TryGetValue((sbyte)(i - 1), out chalkPrevious);
            chalks.Add(i, RandomChalk(chalkPrevious));
        }

        // Добавление картинок
        pictBottom = new Picture(Random.Range(-2.0f, 2.0f), Random.Range(1.0f, 3.0f));
        pictures.Add(0, pictBottom);

        for (sbyte i = 1; i < 17; i++)
        {
            Picture pictPrevious;
            pictures.TryGetValue((sbyte)(i - 1), out pictPrevious);
            pictures.Add(i, new Picture(Random.Range(-2.0f, 2.0f), pictPrevious.Exemplar.transform.position.y + Random.Range(1.0f, 4.0f)));
        }
    }
示例#14
0
 public void Execute()
 {
     Chalk.BlueLine(toEcho);
 }
示例#15
0
 private static void SolverOnOnStepTaken(int i, int j)
 {
     Thread.Sleep(50);
     PrintBasicCLI();
     Chalk.GreenLine("Solving...");
 }
示例#16
0
 private static void SolverOnOnSolverFinished(TimeSpan timetaken)
 {
     PrintBasicCLI();
     Chalk.GreenLine($"Sudoku solved in {timetaken}");
 }