/// <summary> /// Ф:Проверяет ситуацию, когда кто-то сделал рейз из позней позиции в неоткрытом банке /// </summary> public static bool WasStealToPlayer(this Game game, PlayerHistory ph) { var playersInStealSituations = game.PlayerHistories.Where(p => p.PlayerName != ph.PlayerName && game.IsStealSituationForPlayer(p)); return(playersInStealSituations.Any(p => p.HandActions.RealActions().First().IsRaiseAction())); }
public PlayerHistoryDialog(ITranslations translations, PlayerHistory history) : base(translations, "PlayerHistoryDialog.ui", "playerhistory") { string intro, built; intro = Catalog.GetString("The graph below shows the player's game score evolution."); if (history.Games.Count < 2) { built = Catalog.GetString("You need more than one game session recorded to see the score evolution."); } else { built = String.Format(Catalog.GetPluralString("It is built using the results of {0} recorded game session.", "It is built using the results of the last {0} recorded game sessions.", history.Games.Count), history.Games.Count); } // Translators: "The graph below" + "It is built using" sentences label_playerhistory.Text = String.Format(Catalog.GetString("{0} {1}"), intro, built); drawing_area = new CairoPreview(translations, history); drawing_area.SetSizeRequest(history_preview.WidthRequest, history_preview.HeightRequest); history_preview.Add(drawing_area); drawing_area.Visible = true; checkbutton_total.Label = Catalog.GetString("Total"); checkbutton_logic.Label = GameTypesDescription.GetLocalized(translations, GameTypes.LogicPuzzle); checkbutton_calculation.Label = GameTypesDescription.GetLocalized(translations, GameTypes.Calculation); checkbutton_memory.Label = GameTypesDescription.GetLocalized(translations, GameTypes.Memory); checkbutton_verbal.Label = GameTypesDescription.GetLocalized(translations, GameTypes.VerbalAnalogy); checkbutton_total.Active = checkbutton_memory.Active = checkbutton_logic.Active = checkbutton_calculation.Active = checkbutton_verbal.Active = true; }
public void PersonalRecordDone() { PlayerHistory history = new PlayerHistory() { ConfigPath = "." }; GameSessionHistory game = new GameSessionHistory() { GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey) }; history.Clean(); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD - 1; i++) { history.SaveGameSession(game); } game.LogicScore = 20; history.SaveGameSession(game); game.LogicScore = 30; history.SaveGameSession(game); Assert.AreEqual(1, history.GetLastGameRecords().Count, "We have just recorded a personal record"); }
public void ScoreLowerThanPrevious() { PlayerHistory history = new PlayerHistory() { ConfigPath = "." }; GameSessionHistory game = new GameSessionHistory() { GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey) }; history.Clean(); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD - 1; i++) { history.SaveGameSession(game); } game.LogicScore = 30; history.SaveGameSession(game); game.LogicScore = 20; history.SaveGameSession(game); Assert.AreEqual(0, history.GetLastGameRecords().Count, "Score saved was lower than previous, no record"); }
/// <summary> /// Ф:Проверяет стиллинговую ситуацию для игрока /// </summary> public static bool IsStealSituationForPlayer(this Game game, PlayerHistory playerHistory) { var playersCount = game.PlayerHistories.Count; if (playersCount < 3) { return(false); } if (!playerHistory.HandActions.PreflopHandActions().RealActions().Any()) { return(false); } if (!playerHistory.IsInStealPosition()) { return(false); } var allPreflopHandActions = game.AllPreflopHandActions().RealActions().ToList(); var positionAction = allPreflopHandActions.Where(ha => ha.PlayerName == playerHistory.PlayerName).OrderBy(ha => ha.Index).First(); if (!allPreflopHandActions.AllFoldedBeforeAction(positionAction)) { return(false); } return(true); }
// this is old public override TrickResults CalculateResults(GnoteBar bar, GnoteSequence cSequence, PlayerHistory history) { Gnote gPrev = bar.PreviousNote (); Gnote g = bar.LastNote (); if (gPrev != null) { if (g.GetKey () == gPrev.GetKey ()) { return new WasSameKeyResult(); } } if (g != null) { if (g.GetKey () == cSequence.anchorKey) { return new WasAnchorKeyResult (); } } KeyScoreValue ksv = KeyData.Instance.GetKeyScoreValue (g.GetKey ()); if (ksv != null) { string trickCaption = ksv.name; float trickScore = ksv.points; return new TrickResults(trickScore, 0, trickCaption); } else { return new TrickResults(); } }
// Records a player's mission result in all the places that needs it public static void RecordPlayerActivity(MissionResult mresult, string clientId, string companyName, DateTime resultTime) { // For backwards compatibility, record this in the connectionStore for now. Holder.connectionStore[clientId].companyName = companyName; Holder.connectionStore[clientId].lastSystemFoughtAt = mresult.systemName; Holder.connectionStore[clientId].lastFactionFoughtForInWar = mresult.employer; // For now, the player Id is their hashed IP address var companyActivity = new CompanyActivity { employer = mresult.employer, target = mresult.target, systemId = mresult.systemName, companyName = companyName, resultTime = resultTime, result = mresult.result }; var history = Holder.playerHistory.SingleOrDefault(x => clientId.Equals(x.Id)); if (history == null) { history = new PlayerHistory { Id = clientId, lastActive = resultTime }; } history.lastActive = resultTime; history.activities.Add(companyActivity); Holder.playerHistory.Add(history); }
public void NewPlayerInputStream(TimeSpan newLifeTimeSinceLevelStart) { // initialize the player move history with an initial capacity of 50 recorded moves PlayerHistory.Add(new List <PlayerGhostData>(50)); nextPlayerCursors.Add(0); currentStreamDelta = newLifeTimeSinceLevelStart; }
// Update is called once per frame void Update() { if (currentScene != SceneManager.GetActiveScene().buildIndex) { playerHistory = FindObjectOfType <PlayerHistory>(); } currentScene = SceneManager.GetActiveScene().buildIndex; if (wordManager.wordBankActive == true) { notePad = playerHistory.wordList; for (int i = 0; i < notePad.Count; i++) { if (!created.Contains(notePad[i])) { GameObject newButton = (GameObject)Instantiate(buttonPrefab); newButton.GetComponentInChildren <Text>().text = notePad[i]; newButton.transform.SetParent(notePadPanel.transform, false); //Vector3 moveDown = newButton.transform.position; newButton.GetComponentInChildren <Button>().onClick.AddListener(() => textManager.onWordClick(newButton.GetComponentInChildren <Text>().text)); //moveDown.y -= 34f * (float)i; //newButton.transform.position = moveDown; newButton.GetComponent <Button>().navigation = customNav; created.Add(notePad[i]); Debug.Log(notePad[i]); } } wordManager.wordBankActive = false; } }
// Use this for initialization void Start() { playerHistory = FindObjectOfType <PlayerHistory>(); notePadPanel = GameObject.Find("NotePanel"); customNav = new Navigation(); customNav.mode = Navigation.Mode.None; }
public void NewSceneLoaded() { cameraZoom = FindObjectOfType <ViewSwitch>(); playerHistory = FindObjectOfType <PlayerHistory>(); playerMovement = FindObjectOfType <PlayerMovement>(); playerMovement.frozen = false; }
public void MinGamesRecord() { PlayerHistory history; GameSessionHistory game = new GameSessionHistory(); game.GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey); history = new PlayerHistory(); history.ConfigPath = "."; history.Clean(); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD - 2; i++) { history.SaveGameSession(game); } game.LogicScore = 10; history.SaveGameSession(game); Assert.AreEqual(0, history.GetLastGameRecords().Count, "Did not reach MinPlayedGamesKey, the game should not be a person record yet"); game.LogicScore = 30; history.SaveGameSession(game); Assert.AreEqual(1, history.GetLastGameRecords().Count, "We have just recorded a personal record"); game.LogicScore = 20; history.SaveGameSession(game); Assert.AreEqual(0, history.GetLastGameRecords().Count, "Score saved was lower than previous, no record"); }
public PreferencesDialog(ITranslations translations, PlayerHistory history) : base(translations, "PreferencesDialog.ui", "preferences") { this.history = history; prefspinbutton.Value = Preferences.Get <int> (Preferences.MemQuestionTimeKey); prefcheckbutton.Active = Preferences.Get <bool> (Preferences.MemQuestionWarnKey); maxstoredspinbutton.Value = Preferences.Get <int> (Preferences.MaxStoredGamesKey); minplayedspinbutton.Value = Preferences.Get <int> (Preferences.MinPlayedGamesKey); colorblindcheckbutton.Active = Preferences.Get <bool> (Preferences.ColorBlindKey); englishcheckbutton.Active = Preferences.Get <bool> (Preferences.EnglishKey); loadextensionscheckbutton.Active = Preferences.Get <bool> (Preferences.LoadPlugginsKey); usesoundscheckbutton.Active = Preferences.Get <bool> (Preferences.SoundsKey); switch ((GameDifficulty)Preferences.Get <int> (Preferences.DifficultyKey)) { case GameDifficulty.Easy: rb_easy.Active = rb_easy.HasFocus = true; break; case GameDifficulty.Medium: rb_medium.Active = rb_medium.HasFocus = true; break; case GameDifficulty.Master: rb_master.Active = rb_master.HasFocus = true; break; } ListStore store = new ListStore(typeof(string), typeof(Theme)); // DisplayName, theme reference CellRenderer layout_cell = new CellRendererText(); themes_combobox.Model = store; themes_combobox.PackStart(layout_cell, true); themes_combobox.SetCellDataFunc(layout_cell, ComboBoxCellFunc); foreach (Theme theme in ThemeManager.Themes) { store.AppendValues(Catalog.GetString(theme.LocalizedName), theme); } // Default value TreeIter iter; bool more = store.GetIterFirst(out iter); while (more) { Theme theme = (Theme)store.GetValue(iter, COLUMN_VALUE); if (String.Compare(theme.Name, Preferences.Get <string> (Preferences.ThemeKey), true) == 0) { themes_combobox.SetActiveIter(iter); break; } more = store.IterNext(ref iter); } #if !MONO_ADDINS loadextensionscheckbutton.Visible = false; #endif }
public static HandAction FirstRealActionOnFlop(this PlayerHistory playerHistory) { var has = playerHistory.HandActions; var flopHas = has.FlopHandActions(); var realHas = flopHas.RealActions(); return(realHas.First()); }
public static int PfrLp(this PlayerHistory ph) { if (!ph.IsLatePosition()) { return(0); } return(ph.HandActions.PreflopHandActions().RealActions().Any(ha => ha.IsRaiseAction()) ? 1 : 0); }
public static int VpipLp(this PlayerHistory ph) { if (!ph.IsLatePosition()) { return(0); } return(ph.HandActions.PreflopHandActions().NotBlinds().Any(ha => ha.IsCallAction() || ha.IsRaiseAction()) ? 1 : 0); }
private void GetPlayerHistory() { BinaryReader br = null; string hex = ""; try { DirectoryInfo dir = new DirectoryInfo(path); br = new BinaryReader(File.OpenRead(dir.Parent.FullName + "\\PLHISTV2")); for (int i = 0; i < 1860; i++) { List <PlayerHistory> plhist = new List <PlayerHistory>(); for (int j = (i * 133) + 1; j < (i * 133) + 133; j++) { PlayerHistory currentHistory = new PlayerHistory(); br.BaseStream.Position = j; hex = br.ReadByte().ToString("X2"); currentHistory.Year = Convert.ToInt32(hex, 16); if (currentHistory.Year == 0) { break; } br.BaseStream.Position = ++j; hex = br.ReadByte().ToString("X2"); currentHistory.ClubId = Convert.ToInt32(hex, 16); br.BaseStream.Position = ++j; hex = br.ReadByte().ToString("X2"); currentHistory.Apps = Convert.ToInt32(hex, 16); br.BaseStream.Position = ++j; hex = br.ReadByte().ToString("X2"); currentHistory.Goals = Convert.ToInt32(hex, 16); br.BaseStream.Position = (j = j + 2); hex = br.ReadByte().ToString("X2"); currentHistory.Avg = currentHistory.Apps > 0? (double)Convert.ToInt32(hex, 16) / (double)currentHistory.Apps : 0; plhist.Add(currentHistory); } playerHistory.Add(i, plhist); } br.Close(); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.ToString()); } }
public static PlayerHistoryFormView ToViewModel(this PlayerHistory model) { var vm = new PlayerHistoryFormView { Player = model.Users.FullName, Season = model.Seasons.Name, Team = model.Teams.Title, Date = new DateTime(model.TimeStamp) }; return(vm); }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerMovement>(); playerHistory = FindObjectOfType <PlayerHistory>(); cameraSwitcher = FindObjectOfType <ViewSwitch>(); dialogueBoxes = GameObject.Find("UICanvas").transform.GetChild(2).gameObject; listen = GameObject.Find("UICanvas").transform.GetChild(2).GetChild(1).gameObject; question = GameObject.Find("UICanvas").transform.GetChild(2).GetChild(2).gameObject; text = GameObject.Find("UICanvas").transform.GetChild(2).GetChild(0).gameObject; textManager = GameObject.Find("TextBoxManager").GetComponent <TextBoxManager>(); }
public static int ThreeBet(this PlayerHistory ph, Game g) { if (!ph.HandActions.PreflopHandActions().RaiseActions().Any()) { return(0); } var rrIndex = ph.HandActions.PreflopHandActions().RaiseActions().First().Index; return(g.PlayerHistories.Any( eph => eph.PlayerName != ph.PlayerName && eph.HandActions.PreflopHandActions().Any(a => a.IsRaiseAction() && a.Index < rrIndex)) ? 1 : 0); }
void Start() { cameraZoom = FindObjectOfType <ViewSwitch>(); playerHistory = FindObjectOfType <PlayerHistory>(); playerMovement = FindObjectOfType <PlayerMovement>(); wordBank = FindObjectOfType <WordBankManager>(); // textBox = GameObject.Find("DialoguePanel"); listenJsonParser = FindObjectOfType <ListenJsonParser>(); questionJsonParser = FindObjectOfType <QuestionJsonParser>(); playerMovement.frozen = false; canvas = GameObject.Find("UICanvas"); listenJson = listenJsonParser.parseLevelJson("levelOne"); questionJson = questionJsonParser.parseLevelJson("levelOne"); }
public void Clean() { GameSessionHistory game = new GameSessionHistory(); game.GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey); history = new PlayerHistory(); history.ConfigPath = "."; history.Clean(); history.SaveGameSession(game); Assert.AreEqual(1, history.Games.Count); history.Clean(); Assert.AreEqual(0, history.Games.Count); }
public override void UpdateTrickChain(GnoteBar bar, GnoteSequence cSequence, PlayerHistory history) { Gnote hitNote = bar.LastNote (); Gnote previousNote = bar.PreviousNote (); if (previousNote == null) { // this is the first note, so we cool. return; } string hitString = hitNote.GetKey (); string previousString = previousNote.GetKey (); if (bar.ContainsNote (hitString)) { } }
static void AddPlayer(List <PlayerHistory> collection, HistoryMatch m, HistoryPlayer p, bool v) { var data = new PlayerHistory() { MatchId = m.MatchId, When = (DateTime.UtcNow - m.GameStart).Days, Victory = v, Region = m.Region, Hero = p.Hero, Abilities = p.Abilities, Kills = p.Kills, Deaths = p.Deaths, Assists = p.Assists, }; collection.Add(data); }
public async Task <IActionResult> AddPlayerHistory(AddPlayerHistoryModel model) { var history = new PlayerHistory { PlayerId = model.PlayerId, TeamName = model.TeamName, Season = model.Season, LeagueName = model.LeagueName, RedCards = model.RedCards, YellowCards = model.YellowCards, Goals = model.Goals, Position = model.Position, Points = model.Points }; await _playerHistoryService.Create(history); return(RedirectToAction("Index", "Home")); }
public void SaveLoad() { GameSessionHistory game = new GameSessionHistory(); game.GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey); game.MemoryScore = 20; history = new PlayerHistory(); history.ConfigPath = "."; history.SaveGameSession(game); history = new PlayerHistory(); history.ConfigPath = "."; history.Load(); Assert.AreEqual(1, history.Games.Count); Assert.AreEqual(20, history.Games[0].MemoryScore); }
public static void AF_(this PlayerHistory ph, Af afObject) { foreach (var action in ph.HandActions) { switch (action.HandActionType) { case HandActionType.CALL: case HandActionType.ALL_IN_CALL: afObject.CallCount++; break; case HandActionType.ALL_IN_RAISE: case HandActionType.BET: case HandActionType.ALL_IN_BET: case HandActionType.RAISE: afObject.BetRaiseCount++; break; } } }
public void PersonalRecordDoneButPreviousWas0() { PlayerHistory history = new PlayerHistory() { ConfigPath = "." }; GameSessionHistory game = new GameSessionHistory() { GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey) }; history.Clean(); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD; i++) { history.SaveGameSession(game); } game.LogicScore = 30; history.SaveGameSession(game); Assert.AreEqual(0, history.GetLastGameRecords().Count, "No record since previous was 0"); }
public virtual List <PlayerHistory> ParsePlayers(Game game, IReadOnlyList <string> multipleLines) { var players = new List <PlayerHistory>(); for (var i = 0; i < game.NumberOfPlayers; i++) { string oneLine = multipleLines[StartPlayerRow + i]; var player = new PlayerHistory { GameNumber = game.GameNumber, PlayerName = FindPlayerName(oneLine), SeatNumber = FindSeatNumber(oneLine), StartingStack = FindPlayerStartingStack(oneLine), HoleCards = new byte[2], HandActions = new List <HandAction>(), Game = game }; players.Add(player); } InitializePositionsOfPlayers(players, game.ButtonPosition); return(players); }
public void MovePlayersToTeam(int teamId, int[] playerIds, int currentTeamId, int seasonId) { var teamPlayers = db.TeamsPlayers.Where(x => x.TeamId == currentTeamId && playerIds.Contains(x.UserId) && seasonId == x.SeasonId).ToList(); var movedPlayers = new List <TeamsPlayer>(); foreach (var teamPlayer in teamPlayers) { var newTeamPlayer = new TeamsPlayer(); newTeamPlayer.TeamId = teamId; newTeamPlayer.UserId = teamPlayer.UserId; newTeamPlayer.PosId = teamPlayer.PosId; newTeamPlayer.ShirtNum = teamPlayer.ShirtNum; newTeamPlayer.IsActive = teamPlayer.IsActive; newTeamPlayer.SeasonId = teamPlayer.SeasonId ?? seasonId; db.TeamsPlayers.Add(newTeamPlayer); db.SaveChanges(); movedPlayers.Add(newTeamPlayer); } db.TeamsPlayers.RemoveRange(teamPlayers); db.SaveChanges(); if (movedPlayers.Count > 0) { foreach (var movedPlayer in movedPlayers) { var history = new PlayerHistory(); history.SeasonId = movedPlayer.SeasonId ?? seasonId; history.TeamId = movedPlayer.TeamId; history.UserId = movedPlayer.UserId; history.TimeStamp = DateTime.UtcNow.Ticks; db.PlayerHistory.Add(history); } db.SaveChanges(); } }
public void MinGamesNotReached() { PlayerHistory history = new PlayerHistory() { ConfigPath = "." }; GameSessionHistory game = new GameSessionHistory() { GamesPlayed = Preferences.Get <int> (Preferences.MinPlayedGamesKey) }; history.Clean(); for (int i = 0; i < PlayerPersonalRecord.MIN_GAMES_RECORD - 2; i++) { history.SaveGameSession(game); } game.LogicScore = 10; history.SaveGameSession(game); Assert.AreEqual(0, history.GetLastGameRecords().Count, "Did not reach MinPlayedGamesKey, the game should not be a personal record yet"); }
public void TryToGuess() { ColorEngine.White(); Console.WriteLine($"Try to guess a number from 0 to {MaxValue}. You have {Attempts} attempts"); var history = new PlayerHistory(); while (Attempts > 0 && !IsWon) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Enter the estimated number"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.Write(">>> "); if (int.TryParse(Console.ReadLine(), out int estimatedNumber)) { if (estimatedNumber > MaxValue || estimatedNumber < MinValue) { ColorEngine.Red(); Console.WriteLine("Out of range"); continue; } Attempts--; ColorEngine.White(); switch (estimatedNumber.CompareTo(ExpectedNumber)) { case (int)Equality.Bigger: { history.AddAction($"Entered number Bigger({estimatedNumber}) than expected({ExpectedNumber})"); Console.WriteLine($"\tYour entered number BIGGER than expected. You have {Attempts} attempts"); break; } case (int)Equality.Less: { history.AddAction($"Entered number({estimatedNumber}) LESS than expected({ExpectedNumber})"); Console.WriteLine($"\tYour entered number LESS than expected. You have {Attempts} attempts"); break; } case (int)Equality.Equals: { IsWon = true; history.AddAction($"You Won!!"); Console.WriteLine("\tCongratulations, you won!"); break; } default: break; } } else { ColorEngine.Red(); Console.WriteLine("YOU'VE GOT TO ENTER A N_U_M_B_E_R"); } } if (!IsWon) { Console.WriteLine($"Expected number is: {ExpectedNumber}. You loose"); history.AddAction($"Loooooseee :=("); } Console.WriteLine(); TheGame.DataBase.AddHistoryToCurrentAccount(history); }
public Player(int n){ playerIndex = n; history = new PlayerHistory (); }
public virtual TrickResults CalculateResults(GnoteBar bar, GnoteSequence cSequence, PlayerHistory history) { // overwrite me return new TrickResults(); }
public virtual void UpdateTrickChain(GnoteBar bar, GnoteSequence cSequence, PlayerHistory history) { // over }