private BranchAndBoundSettings <UpperBoundScheme> GetSettings() { var @default = BranchAndBoundSettings <UpperBoundScheme> .Default; var upperBoundScheme = Choose("Choose #upper bound# scheme", () => @default.UpperBoundScheme, ("Greedy", 'G', () => UpperBoundScheme.GreedySolution), ("R", 'R', () => UpperBoundScheme.RandomizedSolution)); return(new BranchAndBoundSettings <UpperBoundScheme>(upperBoundScheme)); }
public void Run() { Console.Out.WriteLine("Press any key after worker role is booted."); Console.ReadKey(true); do { Console.Clear(); Choose()(); } while (reader.Confirm("Run more operations?")); }
private void Choose_Btn_Click(object sender, EventArgs e) { DialogResult result = Choose.ShowDialog(); filePath = Choose.FileName; label2.Text = filePath; }
public static void Skill_2() { if (PlayerInfo.skilllvl[1] > 0) { if (PlayerInfo.skilllvl[1] > 1) { skillRange_2 = 25; } else { skillRange_2 = 20; } if (PlayerInfo.qualify[2] == 2) { if (PlayerInfo.skilllvl[1] > 2) { PlayerInfo.skillcd[1] = 3 - Q13; } else { PlayerInfo.skillcd[1] = 4 - Q13; } AreaATK.Area_ATK_Myself(ConnectAndJoinRandom.character, 2, RandomDie.pad, skillRange_2); } else { Choose.Selecting(ConnectAndJoinRandom.character, 2, skillRange_2); } } }
public Strategy(IStrategy st) { ema = new EMA(); shortEMA = new List <double>(32768); longEMA = new List <double>(32768); shortDay = new List <double>(512); longDay = new List <double>(512); shortTick = new List <double>(2097152); longTick = new List <double>(2097152); Send += Analysis; SendTick += new StatisticalAnalysisOnWidth().Analysis; this.st = st; if (st.Division) { info = new Information(st); } GetChart(); if (st.Division) { info.Log(); return; } Send -= Analysis; api = PublicFutures.Get(); api.Retention = Retention; result = Choose.Show("Decide How to Order. . .", "Notice", "MarketPrice", "SpecifyPrice", "DotHighPrice"); om = order[result]; api.Send += Analysis; }
public static void Skill_1() { if (PlayerInfo.skilllvl[0] > 0) { if (PlayerInfo.qualify[2] == 2) { if (PlayerInfo.skilllvl[0] == 1) { PlayerInfo.skillcd[0] = 4; } else if (PlayerInfo.skilllvl[0] == 2) { PlayerInfo.skillcd[0] = 3; } else if (PlayerInfo.skilllvl[0] == 3) { PlayerInfo.skillcd[0] = 2; } AreaATK.Area_ATK_Myself(ConnectAndJoinRandom.character, 1, RandomDie.pad, skillRange_1); } else { Choose.Selecting(ConnectAndJoinRandom.character, 1, skillRange_1); } } }
private void btn_add_product_Click(object sender, EventArgs e) { lbl_qty.Text = "الكمية بــ "; lbl_min_qty.Text = "الكمية بــ "; Choose frm = new Choose("products"); frm.ShowDialog(); txt_p_id.Text = frm.dgv.CurrentRow.Cells[0].Value.ToString(); txt_p_name.Text = frm.dgv.CurrentRow.Cells[1].Value.ToString(); lbl_qty.Text += frm.dgv.CurrentRow.Cells[3].Value.ToString(); txt_min_qty.Text = string.Empty; txt_qty.Text = string.Empty; if (frm.dgv.CurrentRow.Cells[4].Value.ToString() != string.Empty) { lbl_min_qty.Text += frm.dgv.CurrentRow.Cells[4].Value.ToString(); txt_min_qty.Enabled = true; } else { txt_min_qty.Enabled = false; txt_min_qty.Text = string.Empty; lbl_min_qty.Text = "الكمية بــ "; } txt_qty.Focus(); }
private void SetChoice(TextBlock textBlock, QuestionChoice choice) { if (choice == null) { textBlock.Visibility = Visibility.Hidden; } else { textBlock.Inlines.Clear(); if (!string.IsNullOrEmpty(choice.ImageUrl)) { textBlock.Inlines.Add(new Run(choice.Text) { BaselineAlignment = BaselineAlignment.Center }); textBlock.Inlines.Add(new Image() { Source = new BitmapImage(new Uri(choice.ImageUrl)), Stretch = Stretch.Uniform }); } else { textBlock.Text = choice.Text; } textBlock.Visibility = Visibility.Visible; textBlock.MouseDown += (sender, e) => { Choose?.Invoke(choice); }; } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description,IsDeleted,TimeDeleted")] Choose choose) { if (id != choose.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(choose); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChooseExists(choose.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(choose)); }
public static void Skill_1() { if (PlayerInfo.skilllvl[0] > 0) { Choose.Selecting(ConnectAndJoinRandom.character, 1, skillRange); } }
private void 고급ToolStripMenuItem_Click(object sender, EventArgs e) { score = 0; SetDefault(); choose = Choose.Three; SetLabel(); }
//Get Delete public ActionResult Delete(int?id, bool?concurrencyError) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.Conflict)); } Choose choose = db.Chooses.Find(id); if (choose == null) { if (concurrencyError == true) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } return(HttpNotFound()); } if (concurrencyError.GetValueOrDefault()) { if (choose == null) { ViewBag.ConcurrencyErrorMessage = "The record you attempted to delete " + "was deleted by another user after you got the original values. " + "Click the Back to List hyperlink."; } else { ViewBag.ConcurrencyErrorMessage = "The record you attempted to delete " + "was modified by another user after you got the original values. " + "The delete operation was canceled and the current values in the " + "database have been displayed. If you still want to delete this " + "record, click the Delete button again. Otherwise " + "click the Back to List hyperlink."; } } return(View(choose)); }
private void btn_Choose_Click(object sender, EventArgs e) { Choose choo = new Choose(this); choo.MdiParent = this; SetMdiForm(choo.Text, typeof(Choose)); }
public Korea(int type) { InitializeComponent(); dr = Choose.Show("Please Select the Button You Want to Proceed. . .", "Choose", "Trading", "BackTest", "Exit"); if (dr == DialogResult.Yes) { Confirm.Get().Show(); api = Futures.Get(); new Statistics(type); new Temporary(type); api.SetAPI(axAPI); api.StartProgress(type); api.SendExit += OnReceiveExit; } else if (dr == DialogResult.No) { axAPI.Dispose(); int i, l = type > 0 ? 50 : 100; for (i = type > 0 ? 1 : 10; i < l; i++) { new Statistics(i, type); } new Storage(type); Box.Show("Complete. . .♬", "Notice", 3750); OnReceiveExit(); } else { OnReceiveExit(); } }
public static void DetFunction(int[] nums, Choose choose) { switch (choose) { case Choose.increase: for (int i = 0; i < nums.Length - 1; i++) { for (int j = i + 1; j < nums.Length; j++) { if (nums[i] < nums[j]) { Console.WriteLine("по возрастанию"); } } } break; case Choose.decrease: for (int i = 0; i < nums.Length - 1; i++) { for (int j = i + 1; j < nums.Length; j++) { if (nums[i] > nums[j]) { Console.WriteLine("по убыванию"); } } } break; } }
public static void ShowContents(Choose choose) { ArrayOfString[] twoDemimention = null; try { twoDemimention = choose.Invoke(); } catch (SqlException e) { Console.WriteLine("Database can't be reached"); } catch (Exception e) { Console.WriteLine("The program encountered errors"); } for (int i = 0; i < twoDemimention.Length; i++) { ArrayOfString oneDemimention = twoDemimention[i]; for (int j = 0; j < oneDemimention.Count; j++) { string content = oneDemimention[j]; Console.Write("{0} ", content); } Console.WriteLine(); } }
public ImageWindow(ImageSource source, Choose choo) { InitializeComponent(); obrazek.Source = source; this.choo = choo; }
public void ChooseShouldReturnItemByIndex() { var func = new Choose(); var parsingContext = ParsingContext.Create(); var result = func.Execute(FunctionsHelper.CreateArgs(1, "A", "B"), parsingContext); Assert.AreEqual("A", result.Result); }
public void ChooseThreeTrueAndOtherWise() { var tag = new Choose(); var whenTrue = new When(); whenTrue.Body = new MockAttribute(new Constant("True1")); whenTrue.Select = new MockAttribute(new Constant("/results/value[position()=1]")); whenTrue.Source = new MockAttribute(new Constant("xml")); tag.AddNestedTag(whenTrue); var whenTrue2 = new When(); whenTrue2.Body = new MockAttribute(new Constant("True2")); whenTrue2.Select = new MockAttribute(new Constant("/results/value[position()=1]")); whenTrue2.Source = new MockAttribute(new Constant("xml")); tag.AddNestedTag(whenTrue2); var whenTrue3 = new When(); whenTrue3.Body = new MockAttribute(new Constant("True3")); whenTrue3.Select = new MockAttribute(new Constant("/results/value[position()=1]")); whenTrue3.Source = new MockAttribute(new Constant("xml")); tag.AddNestedTag(whenTrue2); var otherwise = new Otherwise(); otherwise.Body = new MockAttribute(new Constant("Ötherwise")); tag.AddNestedTag(otherwise); Assert.That(tag.Evaluate(_model), Is.EqualTo("True1")); }
public void ChooseOnlyOtherwise() { var tag = new Choose(); var otherwise = new Otherwise(); otherwise.Body = new MockAttribute(new Property("Body1")); tag.AddNestedTag(otherwise); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(Body1)); }
public void ChooseOnlyOtherwise() { var tag = new Choose(); var otherwise = new Otherwise(); otherwise.Body = new MockAttribute(new Constant("Body1")); tag.AddNestedTag(otherwise); Assert.That(tag.Evaluate(_model), Is.EqualTo("Body1")); }
public void ChooseWithInvalidArgumentReturnsPoundValue() { var func = new Choose(); var parsingContext = ParsingContext.Create(); var args = FunctionsHelper.CreateArgs(); var result = func.Execute(args, parsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
static void Main(string[] args) { var ui = new UserInterface(); var service = new CustomerService(); //var customers = service.GetAllCustomers(); // 1. Execute the request user while (true) { var customers = service.GetAllCustomers(); // 1. Show menu ui.DisplayMenu(); // 2. User chosse an option: Add, Edit, Delete, Exit Choose option = ui.GetOption(); // 3.Based on the option, execute the operation switch (option) { // Show list customer case Choose.View: ui.ShowListCustomer(customers); break; // Add customers from users case Choose.Add: AddCustomer(ui, service); break; // Edit customer case Choose.Edit: EditCustomer(ui, service, customers); break; //remove customer case Choose.Delete: DeleteCustomter(ui, service, customers); break; //clear screen case Choose.Clear: ui.ClearScreen(); break; //exit case Choose.Exit: Console.WriteLine("=========*========="); ui.ShowMessage("\t" + Message.EXIT); return; default: return; } Console.WriteLine(); } }
public ActionResult New(int id) { var langs = session.CreateCriteria <Language>().List <Language>(); return(View(new NewSolutionForm { Languages = Choose.Create(langs, l => l.Name, l => l.Name), ProblemId = id })); }
public ActionResult Create(Choose choose) { if (ModelState.IsValid) { db.Chooses.Add(choose); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(choose)); }
public void ChooseOnlyOneWhenTrue() { var tag = new Choose(); var whenTrue = new When(); whenTrue.Body = new MockAttribute(new Property("Body2")); whenTrue.Test = new MockAttribute(new Property("True")); tag.AddNestedTag(whenTrue); Assert.That(tag.Evaluate(new TagModel(this)), Is.EqualTo(Body2)); }
private static XElement CreateChooseXml(Choose choose) { var element = new XElement("Choose"); foreach (var when in choose.Whens) { element.Add(CreateWhenXml(when)); } return(element); }
public async Task <IActionResult> Create([Bind("Id,Title,Description,IsDeleted,TimeDeleted")] Choose choose) { if (ModelState.IsValid) { _context.Add(choose); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(choose)); }
public void ChooseOnlyOneWhenTrue() { var tag = new Choose(); var whenTrue = new When(); whenTrue.Body = new MockAttribute(new Constant("Body1")); whenTrue.Select = new MockAttribute(new Constant("/results/value[position()=1]")); whenTrue.Source = new MockAttribute(new Constant("xml")); tag.AddNestedTag(whenTrue); Assert.That(tag.Evaluate(_model), Is.EqualTo("Body1")); }
public void Calculatemod_Test() { Choose cs = new Choose(); int pr = 17; int ge = 3; int prvt = 15; int r = ((int)(Mathf.Pow(ge, prvt)) % pr); int res = cs.modcalc(pr, ge, prvt); Assert.That(res, Is.EqualTo(r)); }
void SendChoose(Choose c) { if(PlayerVariables.bPlayingOnServer) { networkView.RPC ("SendChooseInfo_Server", RPCMode.Server, (int)c, Network.player); } else if(PlayerVariables.bPlayingAgainstIA) { _EnemyChoose = PlayerVariables.enemyAI.GetChoosePaperGame(); } else { networkView.RPC ("SendChooseInfo", PlayerVariables.opponent, (int)c); } }
void SendChooseInfo(int c) { _EnemyChoose = (Choose)c; }
void Update() { if(PlayerVariables.bPlayingAgainstIA && bAIStartGame && AITimerStartGame.GetMiliseconds() >= 1) { bAIStartGame = false; AITimerStartGame.Stop(); Application.LoadLevel(nextLevel); } AITimerStartGame.Update(); if(bEnemyReady && bPlayerReady && !bChoosingWinner && !bSelectingPlayerOrder) { if(!bPlayingPaperGame) { bPlayingPaperGame = true; bSelectingCard = true; } } if(bSelectingPlayerOrder) { if(bCanSelect) { if(MouseOn(xFirstTurn, yFirstTurn, wTurn, hTurn, Input.mousePosition)) { if(firstTurnTexture != firstTurnOver) { firstTurnTexture = firstTurnOver; SelectFirst(); } if(Input.GetMouseButtonUp(0)) { StartGame(true); //MultiplayerScript.DeckName = PlayerPrefs.GetString("DefaultDeck"); Application.LoadLevel(nextLevel); } } else { if(firstTurnTexture != firstTurnIdle) { firstTurnTexture = firstTurnIdle; } } if(MouseOn(xSecondTurn, ySecondTurn, wTurn, hTurn, Input.mousePosition)) { if(secondTurnIdle != secondTurnOver) { secondTurnTexture = secondTurnOver; SelectSecond(); } if(Input.GetMouseButtonUp(0)) { StartGame(false); //MultiplayerScript.DeckName = PlayerPrefs.GetString("DefaultDeck"); Application.LoadLevel(nextLevel); } } else { secondTurnTexture = secondTurnIdle; } } else { if(PlayerVariables.bPlayingAgainstIA) { if(PlayerVariables.enemyAI.ChooseFirstTurn()) { SelectFirstRPC(); PlayerVariables.bFirstTurn = false; } else { SelectSecondRPC(); PlayerVariables.bFirstTurn = true; } if(!bAIStartGame) { AITimerStartGame.Start(); bAIStartGame = true; } } } return; } if(bChoosingWinner) { endGameDelay -= Time.deltaTime; if(endGameDelay <= 0) { bPlayingPaperGame = false; if(_Choose == _EnemyChoose) { deltaX = deltaY = enemyY = 0; _Choose = _EnemyChoose = Choose.NONE; bPlayingPaperGame = true; bSelectingCard = true; bCanSelect = false; bSelectedCCard = false; bSelectingPlayerOrder = false; enemyChoose = Resources.Load ("FaceDownCard") as Texture2D; bChoosingWinner = false; } else { bSelectingPlayerOrder = true; bChoosingWinner = false; if(_Choose == Choose.PAPER && _EnemyChoose == Choose.ROCK || _Choose == Choose.ROCK && _EnemyChoose == Choose.SCISSOR || _Choose == Choose.SCISSOR && _EnemyChoose == Choose.PAPER) { bCanSelect = true; } else { bCanSelect = false; } } } return; } if(bPlayingPaperGame) { if(bSelectedCCard) { if(_EnemyChoose != Choose.NONE) { if(_EnemyChoose == Choose.PAPER) { enemyChoose = paper; } else if(_EnemyChoose == Choose.ROCK) { enemyChoose = rock; } else if(_EnemyChoose == Choose.SCISSOR) { enemyChoose = scissor; } bChoosingWinner = true; endGameDelay = 1; } return; } if(bSelectingCard) { if(MouseOn(xRock, yRock, _w, _y, Input.mousePosition) && Input.GetMouseButtonUp(0)) { bSelectingCard = false; _Choose = Choose.ROCK; Debug.Log ("Rock"); } if(MouseOn(xScissor, yScissor, _w, _y, Input.mousePosition) && Input.GetMouseButtonUp(0)) { bSelectingCard = false; _Choose = Choose.SCISSOR; } if(MouseOn(xPaper, yPaper, _w, _y, Input.mousePosition) && Input.GetMouseButtonUp(0)) { bSelectingCard = false; _Choose = Choose.PAPER; } } else { bool bDone = true; if(_Choose == Choose.PAPER) { if(Math.Abs((deltaX + xPaper) - middleX) > 5) { if(deltaX + xPaper < middleX) { deltaX += speed * Time.deltaTime; } else { deltaX -= speed * Time.deltaTime; } bDone = false; } else { deltaX = middleX - xPaper; } if(Math.Abs((deltaY + yPaper) - middleY) > 5) { if(deltaY + yPaper < middleY) { deltaY += speed * Time.deltaTime; } else { deltaY -= speed * Time.deltaTime; } bDone = false; } else { deltaY = middleY - yPaper; } } else if(_Choose == Choose.ROCK) { if(Math.Abs((deltaX + xRock) - middleX) > 5) { if(deltaX + xRock < middleX) { deltaX += speed * Time.deltaTime; } else { deltaX -= speed * Time.deltaTime; } bDone = false; } else { deltaX = middleX - xRock; } if(Math.Abs((deltaY + yRock) - middleY) > 5) { if(deltaY + yRock < middleY) { deltaY += speed * Time.deltaTime; } else { deltaY -= speed * Time.deltaTime; } bDone = false; } else { deltaY = middleY - yRock; } } else if(_Choose == Choose.SCISSOR) { if(Math.Abs((deltaX + xScissor) - middleX) > 5) { if(deltaX + xScissor < middleX) { deltaX += speed * Time.deltaTime; } else { deltaX -= speed * Time.deltaTime; } bDone = false; } else { deltaX = middleX - xScissor; } if(Math.Abs((deltaY + yScissor) - middleY) > 5) { if(deltaY + yScissor < middleY) { deltaY += speed * Time.deltaTime; } else { deltaY -= speed * Time.deltaTime; } bDone = false; } else { deltaY = middleY - yScissor; } } if(Math.Abs((enemyDeltaY + enemyY) - enemyMiddleY) > 5) { if(enemyDeltaY + enemyY < enemyMiddleY) { enemyDeltaY += speed * Time.deltaTime; } else { enemyDeltaY -= speed * Time.deltaTime; } bDone = false; } else { enemyDeltaY = enemyMiddleY - enemyY; } if(bDone) { bSelectedCCard = true; SendChoose(_Choose); } } } }