public void UpdateRankingForSpecificUser(aspnet_User user, int uid) { int NoAccepted = uvareq.GetUvaUserSolvedProblems(uid); Rank userRank; try { if ( user.Rank != null) { user.Rank.Solved = NoAccepted; } else { userRank = new Rank() { IdUser = user.UserId, UvaUserName = user.UserName, Solved = NoAccepted }; modx.Ranks.InsertOnSubmit(userRank); } modx.SubmitChanges(); } catch (NullReferenceException ex) { } //test if null then same solved }
static int GetLimitIndex( Rank rank, Permission permission ) { if( rank.HasLimitSet( permission ) ) { return rank.GetLimit( permission ).Index + 1; } else { return 0; } }
// Card constructor using enumerated types. public Card (Suits suit, Rank rank) { this.suit = suit; this.rank = rank; description = this.ToString().ToLower().Replace(" ", "_"); }
public Card(int i) { int shfl = i / 13; suit += shfl; shfl = i % 13; rank += shfl; }
public Bullet(Texture2D texture, Rank rank, Vector2 position, float direction) { this.position = position; this.direction = direction; this.texture = texture; this.rank = rank; }
public static World FindMainWorld(Rank rank) { World rankMain = rank.MainWorld; if (rankMain != null) { return rankMain; } return MainWorld; }
public MonteCarloModel(int rankCount, Rank[] ranks) { MyDistribution = new Distribution(); MyDistribution.RankCount = rankCount; MyDistribution.Ranks = ranks; Run(); }
/// <summary> /// Determines whether [has] [the specified rank]. /// </summary> /// <param name="rank">The rank.</param> /// <param name="suit">The suit.</param> /// <returns> /// <c>true</c> if [has] [the specified rank]; otherwise, <c>false</c>. /// </returns> public bool Has(Rank rank, Suit suit) { if (GetCard(rank, suit) != null) return true; else return false; }
public PokerHand(string cards) { var pokerCards = cards.Split(' ').Select(cardValue => new PokerCard(cardValue)).ToList(); pokerCards.Sort(); var groups = from card in pokerCards group card by card.Denomination; switch (groups.Count()) { case 4: Rank = Rank.Pair; break; case 3: Rank = Rank.TwoPairs; break; case 2: Rank = Rank.FullHouse; break; case 5: Rank = Rank.Straight; for (int i = 1; i < pokerCards.Count; i++) { if (pokerCards[i].Denomination - pokerCards[i - 1].Denomination != 1) { Rank = Rank.UNKNOWN; break; } } break; default: Rank = Rank.UNKNOWN; break; } }
/// <summary> Adds a new PlayerInfo entry for a player who has never been online, by name. </summary> /// <returns> A newly-created PlayerInfo entry. </returns> public PlayerInfo AddUnrecognizedPlayer( string name, Rank startingRank, RankChangeType rankChangeType ) { if( name == null ) throw new ArgumentNullException( "name" ); if( startingRank == null ) throw new ArgumentNullException( "startingRank" ); int id = GetNextID(); PlayerInfo info = new PlayerInfo( id, name, startingRank, rankChangeType, false ); trie.Add( name, info ); return info; }
/// <summary> Adds a new PlayerInfo entry for an actual, logged-in player. </summary> /// <returns> A newly-created PlayerInfo entry. </returns> public PlayerInfo AddPlayer( string name, Rank startingRank, RankChangeType rankChangeType, IPAddress address ) { if( name == null ) throw new ArgumentNullException( "name" ); if( address == null ) throw new ArgumentNullException( "address" ); int id = GetNextID(); PlayerInfo info = new PlayerInfo( id, name, startingRank, rankChangeType, address ); trie.Add( name, info ); return info; }
public Digimon(string nameRus, string nameEng, Rank rank, Type type, Speciality speciality) { NameEng = nameEng; NameRus = nameRus; Rank = rank; Type = type; Speciality = speciality; }
public Member(String name, Rank rank = Rank.Member, int groupId = -1) { Random rand = new Random(); this.ID = rand.Next(); this.VillageName = name; this.Rank = rank; this.GroupId = groupId; }
public Card(Rank rank, Suit suit) : this() { if (suit == Suit.None) throw new ArgumentException("Suit cannot be none", "suit"); this.Rank = rank; this.Suit = suit; }
private bool Follows(Rank lower, Rank higher) { //Special case, 2 follows ace if (lower == Rank.ACE && higher == Rank.DEUCE) return true; return (int)lower + 1 == (int)higher; }
public DigimonTemp(string nameRus, string nameEng, string sourceCode, string resultCode, Rank rank) { NameRus = nameRus; NameEng = nameEng; SourceCode = sourceCode; ResultCode = resultCode; Rank = rank; }
public static string RankColor(Rank rank) { if (colors.ContainsKey(rank)) { return colors[rank]; } else { return Color.Black; } }
public MonteCarloModel(int rankCount, Rank[] ranks, double mean, double std_dev) { _mean = mean; _std_dev = std_dev; MyDistribution = new Distribution(new SimulationData(), 0); MyDistribution.Ranks = ranks; Run(); }
public PlayerRankChangedEvent(DateTime dateTime, Galaxy galaxy, string name, Rank oldRank, Rank newRank) : base(dateTime, galaxy) { OldRank = oldRank; NewRank = newRank; if (oldRank == newRank) throw new ArgumentException("Ranks must differ for player rank changed event"); PlayerName = name; }
private void cSubstitute_SelectedIndexChanged( object sender, EventArgs e ) { if( cSubstitute.SelectedIndex < 0 ) return; foreach( Rank rank in RankManager.Ranks ) { if( cSubstitute.SelectedItem.ToString() != rank.ToComboBoxOption() ) continue; substituteRank = rank; bDelete.Enabled = true; break; } }
public Alimentatore(FormatoAlimentatore formatoAlimentatore, int potenzaErogata, Rank rank, bool modularita, string nome, string produttore, double prezzo, string descrizione, float peso, Dictionary<Connettore, int> connettori) : base(nome, produttore, prezzo, descrizione, peso, connettori) { _formatoAlimentatore = formatoAlimentatore; _potenzaErogata = potenzaErogata; _rank = rank; _modularita = modularita; }
public static RankModel From(Rank rank) { return new RankModel { Number = rank.Number, Card = rank.Card == null ? null : CardModel.From(rank.Card), Penalty = rank.Darkness }; }
public static IEnumerable<Player> NotRanked( this IEnumerable<Player> source, Rank rank ) { if( source == null ) throw new ArgumentNullException( "source" ); if( rank == null ) throw new ArgumentNullException( "rank" ); foreach( Player player in source ) { if( player.Info.Rank != rank ) { yield return player; } } }
public static IEnumerable<Player> RankedBelow( this IEnumerable<Player> source, Rank maxRank ) { if( source == null ) throw new ArgumentNullException( "source" ); if( maxRank == null ) throw new ArgumentNullException( "maxRank" ); foreach( Player player in source ) { if( player.Info.Rank < maxRank ) { yield return player; } } }
public Criterion( CriterionType type, Rank fromRank, Rank toRank, Condition condition ) { if( fromRank == null ) throw new ArgumentNullException( "fromRank" ); if( toRank == null ) throw new ArgumentNullException( "toRank" ); if( condition == null ) throw new ArgumentNullException( "condition" ); Type = type; FromRank = fromRank; ToRank = toRank; Condition = condition; }
public PermissionOverride CanTarget( Rank targetRank ) { if( includedRanks.Contains( targetRank ) ) { return PermissionOverride.Allow; } else if( excludedRanks.Contains( targetRank ) ) { return PermissionOverride.Deny; } else { return PermissionOverride.None; } }
public DeleteRankPopup( Rank deletedRank ) { InitializeComponent(); foreach( Rank rank in RankManager.Ranks ) { if( rank != deletedRank ) { cSubstitute.Items.Add( rank.ToComboBoxOption() ); } } lWarning.Text = String.Format( lWarning.Text, deletedRank.Name ); cSubstitute.SelectedIndex = cSubstitute.Items.Count - 1; }
public void SelectRank( Rank rank ) { Rank = rank; if( rank == null ) { comboBox.SelectedIndex = -1; Visible = false; } else { comboBox.SelectedIndex = rank.GetLimitIndex( Permission ); Visible = rank.Can( Permission ); } }
public Player(Rank rank, bool master) { Rank = rank; IsNow = true; Ghost = false; Master = master; DRank = Rank.None; Detective = false; RName = string.Empty; }
internal LeaderboardAndRank(IDictionary<string, object> dict) { object value; dict.TryGetValue ("rank", out value); Rank = new Rank ((IDictionary<string,object>)value); dict.TryGetValue ("leaderboard", out value); Leaderboard = new Leaderboard ((IDictionary<string,object>)value); }
// convert file and rank to square which has a 120 based number public static Square FileRanktoSquare(File file, Rank rank) { return((Square)(21 + (int)file) + (10 * (int)rank)); }
/// <summary> /// Returns a <see cref="System.String"/> that represents this instance. /// </summary> /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> public override string ToString() { return(String.Format("{0} of {1}s", Rank.ToString(), Suit.ToString())); }
public Card(Rank rank, Suit suit) { Rank = rank; Suit = suit; }
/// <summary> /// is 2 pair /// </summary> /// <param name="hand"></param> /// <param name="rank"></param> /// <returns></returns> private bool Is2Pair(List <Card> hand, ref Rank rank) { short pair1HighCardValue = 0; int pairCount = 0; short lastPairVal = 0; Card first = hand[0]; foreach (Card c in hand) { short value = c.Value; int count = 0; foreach (Card c2 in hand) { if (c2.Value == c.Value) { if (c2.Value != lastPairVal) { count++; } } } if (count == 2) { pairCount += 1; lastPairVal = c.Value; if (pairCount == 1) { pair1HighCardValue = value; } else { rank.Pair = pair1HighCardValue; rank.Pair2 = value; rank.Name = BPConstants.Rank_2PairDescr; rank.Value = BPConstants.Rank_2Pair; foreach (Card c3 in hand) { if (c3.Value != rank.Pair) { if (c3.Value != rank.Pair2) { //high cards for tie compares can only be 1 for 2 pair rank.Tie1 = c3.Value; break; } } } return(true); } } } return(false); }
/** * @see https://www.openoffice.org/sc/excelfileformat.pdf */ private static Function[] ProduceFunctions() { Function[] retval = new Function[368]; retval[0] = new Count(); // COUNT retval[FunctionID.IF] = new IfFunc(); //nominally 1 retval[2] = LogicalFunction.ISNA; // IsNA retval[3] = LogicalFunction.ISERROR; // IsERROR retval[FunctionID.SUM] = AggregateFunction.SUM; //nominally 4 retval[5] = AggregateFunction.AVERAGE; // AVERAGE retval[6] = AggregateFunction.MIN; // MIN retval[7] = AggregateFunction.MAX; // MAX retval[8] = new Row(); // ROW retval[9] = new Column(); // COLUMN retval[10] = new Na(); // NA retval[11] = new Npv(); // NPV retval[12] = AggregateFunction.STDEV; // STDEV retval[13] = NumericFunction.DOLLAR; // DOLLAR retval[14] = new Fixed(); // FIXED retval[15] = NumericFunction.SIN; // SIN retval[16] = NumericFunction.COS; // COS retval[17] = NumericFunction.TAN; // TAN retval[18] = NumericFunction.ATAN; // ATAN retval[19] = new Pi(); // PI retval[20] = NumericFunction.SQRT; // SQRT retval[21] = NumericFunction.EXP; // EXP retval[22] = NumericFunction.LN; // LN retval[23] = NumericFunction.LOG10; // LOG10 retval[24] = NumericFunction.ABS; // ABS retval[25] = NumericFunction.INT; // INT retval[26] = NumericFunction.SIGN; // SIGN retval[27] = NumericFunction.ROUND; // ROUND retval[28] = new Lookup(); // LOOKUP retval[29] = new Index(); // INDEX retval[30] = new Rept(); // REPT retval[31] = TextFunction.MID; // MID retval[32] = TextFunction.LEN; // LEN retval[33] = new Value(); // VALUE retval[34] = new True(); // TRUE retval[35] = new False(); // FALSE retval[36] = new And(); // AND retval[37] = new Or(); // OR retval[38] = new Not(); // NOT retval[39] = NumericFunction.MOD; // MOD retval[40] = new NotImplementedFunction("DCOUNT"); // DCOUNT retval[41] = new NotImplementedFunction("DSUM"); // DSUM retval[42] = new NotImplementedFunction("DAVERAGE"); // DAVERAGE retval[43] = new DStarRunner(DStarRunner.DStarAlgorithmEnum.DMIN); // DMIN retval[44] = new NotImplementedFunction("DMAX"); // DMAX retval[45] = new NotImplementedFunction("DSTDEV"); // DSTDEV retval[46] = AggregateFunction.VAR; // VAR retval[47] = new NotImplementedFunction("DVAR"); // DVAR retval[48] = TextFunction.TEXT; // TEXT retval[49] = new NotImplementedFunction("LINEST"); // LINEST retval[50] = new NotImplementedFunction("TREND"); // TREND retval[51] = new NotImplementedFunction("LOGEST"); // LOGEST retval[52] = new NotImplementedFunction("GROWTH"); // GROWTH retval[53] = new NotImplementedFunction("GOTO"); // GOTO retval[54] = new NotImplementedFunction("HALT"); // HALT retval[56] = FinanceFunction.PV; // PV retval[57] = FinanceFunction.FV; // FV retval[58] = FinanceFunction.NPER; // NPER retval[59] = FinanceFunction.PMT; // PMT retval[60] = new Rate(); // RATE retval[61] = new Mirr(); // MIRR retval[62] = new Irr(); // IRR retval[63] = new Rand(); // RAND retval[64] = new Match(); // MATCH retval[65] = DateFunc.instance; // DATE retval[66] = new TimeFunc(); // TIME retval[67] = CalendarFieldFunction.DAY; // DAY retval[68] = CalendarFieldFunction.MONTH; // MONTH retval[69] = CalendarFieldFunction.YEAR; // YEAR retval[70] = WeekdayFunc.instance; // WEEKDAY retval[71] = CalendarFieldFunction.HOUR; retval[72] = CalendarFieldFunction.MINUTE; retval[73] = CalendarFieldFunction.SECOND; retval[74] = new Now(); retval[75] = new NotImplementedFunction("AREAS"); // AREAS retval[76] = new Rows(); // ROWS retval[77] = new Columns(); // COLUMNS retval[FunctionID.OFFSET] = new Offset(); //nominally 78 retval[79] = new NotImplementedFunction("ABSREF"); // ABSREF retval[80] = new NotImplementedFunction("RELREF"); // RELREF retval[81] = new NotImplementedFunction("ARGUMENT"); // ARGUMENT retval[82] = TextFunction.SEARCH; retval[83] = new NotImplementedFunction("TRANSPOSE"); // TRANSPOSE retval[84] = new NotImplementedFunction("ERROR"); // ERROR retval[85] = new NotImplementedFunction("STEP"); // STEP retval[86] = new NotImplementedFunction("TYPE"); // TYPE retval[87] = new NotImplementedFunction("ECHO"); // ECHO retval[88] = new NotImplementedFunction("SetNAME"); // SetNAME retval[89] = new NotImplementedFunction("CALLER"); // CALLER retval[90] = new NotImplementedFunction("DEREF"); // DEREF retval[91] = new NotImplementedFunction("WINDOWS"); // WINDOWS retval[92] = new NotImplementedFunction("SERIES"); // SERIES retval[93] = new NotImplementedFunction("DOCUMENTS"); // DOCUMENTS retval[94] = new NotImplementedFunction("ACTIVECELL"); // ACTIVECELL retval[95] = new NotImplementedFunction("SELECTION"); // SELECTION retval[96] = new NotImplementedFunction("RESULT"); // RESULT retval[97] = NumericFunction.ATAN2; // ATAN2 retval[98] = NumericFunction.ASIN; // ASIN retval[99] = NumericFunction.ACOS; // ACOS retval[FunctionID.CHOOSE] = new Choose(); //nominally 100 retval[101] = new Hlookup(); // HLOOKUP retval[102] = new Vlookup(); // VLOOKUP retval[103] = new NotImplementedFunction("LINKS"); // LINKS retval[104] = new NotImplementedFunction("INPUT"); // INPUT retval[105] = LogicalFunction.ISREF; // IsREF retval[106] = new NotImplementedFunction("GetFORMULA"); // GetFORMULA retval[107] = new NotImplementedFunction("GetNAME"); // GetNAME retval[108] = new NotImplementedFunction("SetVALUE"); // SetVALUE retval[109] = NumericFunction.LOG; // LOG retval[110] = new NotImplementedFunction("EXEC"); // EXEC retval[111] = TextFunction.CHAR; // CHAR retval[112] = TextFunction.LOWER; // LOWER retval[113] = TextFunction.UPPER; // UPPER retval[114] = TextFunction.PROPER; // PROPER retval[115] = TextFunction.LEFT; // LEFT retval[116] = TextFunction.RIGHT; // RIGHT retval[117] = TextFunction.EXACT; // EXACT retval[118] = TextFunction.TRIM; // TRIM retval[119] = new Replace(); // Replace retval[120] = new Substitute(); // SUBSTITUTE retval[121] = new Code(); // CODE retval[122] = new NotImplementedFunction("NAMES"); // NAMES retval[123] = new NotImplementedFunction("DIRECTORY"); // DIRECTORY retval[124] = TextFunction.FIND; // Find retval[125] = new NotImplementedFunction("CELL"); // CELL retval[126] = LogicalFunction.ISERR; // IsERR retval[127] = LogicalFunction.ISTEXT; // IsTEXT retval[128] = LogicalFunction.ISNUMBER; // IsNUMBER retval[129] = LogicalFunction.ISBLANK; // IsBLANK retval[130] = new T(); // T retval[131] = new NotImplementedFunction("N"); // N retval[132] = new NotImplementedFunction("FOPEN"); // FOPEN retval[133] = new NotImplementedFunction("FCLOSE"); // FCLOSE retval[134] = new NotImplementedFunction("FSIZE"); // FSIZE retval[135] = new NotImplementedFunction("FReadLN"); // FReadLN retval[136] = new NotImplementedFunction("FRead"); // FRead retval[137] = new NotImplementedFunction("FWriteLN"); // FWriteLN retval[138] = new NotImplementedFunction("FWrite"); // FWrite retval[139] = new NotImplementedFunction("FPOS"); // FPOS retval[140] = new NotImplementedFunction("DATEVALUE"); // DATEVALUE retval[141] = new NotImplementedFunction("TIMEVALUE"); // TIMEVALUE retval[142] = new NotImplementedFunction("SLN"); // SLN retval[143] = new NotImplementedFunction("SYD"); // SYD retval[144] = new NotImplementedFunction("DDB"); // DDB retval[145] = new NotImplementedFunction("GetDEF"); // GetDEF retval[146] = new NotImplementedFunction("REFTEXT"); // REFTEXT retval[147] = new NotImplementedFunction("TEXTREF"); // TEXTREF retval[FunctionID.INDIRECT] = null; // Indirect.Evaluate has different signature retval[149] = new NotImplementedFunction("REGISTER"); // REGISTER retval[150] = new NotImplementedFunction("CALL"); // CALL retval[151] = new NotImplementedFunction("AddBAR"); // AddBAR retval[152] = new NotImplementedFunction("AddMENU"); // AddMENU retval[153] = new NotImplementedFunction("AddCOMMAND"); // AddCOMMAND retval[154] = new NotImplementedFunction("ENABLECOMMAND"); // ENABLECOMMAND retval[155] = new NotImplementedFunction("CHECKCOMMAND"); // CHECKCOMMAND retval[156] = new NotImplementedFunction("RenameCOMMAND"); // RenameCOMMAND retval[157] = new NotImplementedFunction("SHOWBAR"); // SHOWBAR retval[158] = new NotImplementedFunction("DELETEMENU"); // DELETEMENU retval[159] = new NotImplementedFunction("DELETECOMMAND"); // DELETECOMMAND retval[160] = new NotImplementedFunction("GetCHARTITEM"); // GetCHARTITEM retval[161] = new NotImplementedFunction("DIALOGBOX"); // DIALOGBOX retval[162] = TextFunction.CLEAN; // CLEAN retval[163] = new NotImplementedFunction("MDETERM"); // MDETERM retval[164] = new NotImplementedFunction("MINVERSE"); // MINVERSE retval[165] = new NotImplementedFunction("MMULT"); // MMULT retval[166] = new NotImplementedFunction("FILES"); // FILES retval[167] = new IPMT(); retval[168] = new PPMT(); retval[169] = new Counta(); // COUNTA retval[170] = new NotImplementedFunction("CANCELKEY"); // CANCELKEY retval[175] = new NotImplementedFunction("INITIATE"); // INITIATE retval[176] = new NotImplementedFunction("REQUEST"); // REQUEST retval[177] = new NotImplementedFunction("POKE"); // POKE retval[178] = new NotImplementedFunction("EXECUTE"); // EXECUTE retval[179] = new NotImplementedFunction("TERMINATE"); // TERMINATE retval[180] = new NotImplementedFunction("RESTART"); // RESTART retval[181] = new NotImplementedFunction("HELP"); // HELP retval[182] = new NotImplementedFunction("GetBAR"); // GetBAR retval[183] = AggregateFunction.PRODUCT; // PRODUCT retval[184] = NumericFunction.FACT; // FACT retval[185] = new NotImplementedFunction("GetCELL"); // GetCELL retval[186] = new NotImplementedFunction("GetWORKSPACE"); // GetWORKSPACE retval[187] = new NotImplementedFunction("GetWINDOW"); // GetWINDOW retval[188] = new NotImplementedFunction("GetDOCUMENT"); // GetDOCUMENT retval[189] = new NotImplementedFunction("DPRODUCT"); // DPRODUCT retval[190] = LogicalFunction.ISNONTEXT; // IsNONTEXT retval[191] = new NotImplementedFunction("GetNOTE"); // GetNOTE retval[192] = new NotImplementedFunction("NOTE"); // NOTE retval[193] = new NotImplementedFunction("STDEVP"); // STDEVP retval[194] = AggregateFunction.VARP; // VARP retval[195] = new NotImplementedFunction("DSTDEVP"); // DSTDEVP retval[196] = new NotImplementedFunction("DVARP"); // DVARP retval[197] = NumericFunction.TRUNC; // TRUNC retval[198] = LogicalFunction.ISLOGICAL; // IsLOGICAL retval[199] = new NotImplementedFunction("DCOUNTA"); // DCOUNTA retval[200] = new NotImplementedFunction("DELETEBAR"); // DELETEBAR retval[201] = new NotImplementedFunction("UNREGISTER"); // UNREGISTER retval[204] = new NotImplementedFunction("USDOLLAR"); // USDOLLAR retval[205] = new NotImplementedFunction("FindB"); // FindB retval[206] = new NotImplementedFunction("SEARCHB"); // SEARCHB retval[207] = new NotImplementedFunction("ReplaceB"); // ReplaceB retval[208] = new NotImplementedFunction("LEFTB"); // LEFTB retval[209] = new NotImplementedFunction("RIGHTB"); // RIGHTB retval[210] = new NotImplementedFunction("MIDB"); // MIDB retval[211] = new NotImplementedFunction("LENB"); // LENB retval[212] = NumericFunction.ROUNDUP; // ROUNDUP retval[213] = NumericFunction.ROUNDDOWN; // ROUNDDOWN retval[214] = new NotImplementedFunction("ASC"); // ASC retval[215] = new NotImplementedFunction("DBCS"); // DBCS retval[216] = new Rank(); // RANK retval[219] = new Address(); // AddRESS retval[220] = new Days360(); // DAYS360 retval[221] = new Today(); // TODAY retval[222] = new NotImplementedFunction("VDB"); // VDB retval[227] = AggregateFunction.MEDIAN; // MEDIAN retval[228] = new Sumproduct(); // SUMPRODUCT retval[229] = NumericFunction.SINH; // SINH retval[230] = NumericFunction.COSH; // COSH retval[231] = NumericFunction.TANH; // TANH retval[232] = NumericFunction.ASINH; // ASINH retval[233] = NumericFunction.ACOSH; // ACOSH retval[234] = NumericFunction.ATANH; // ATANH retval[235] = new DStarRunner(DStarRunner.DStarAlgorithmEnum.DGET); // DGet retval[236] = new NotImplementedFunction("CreateOBJECT"); // CreateOBJECT retval[237] = new NotImplementedFunction("VOLATILE"); // VOLATILE retval[238] = new NotImplementedFunction("LASTERROR"); // LASTERROR retval[239] = new NotImplementedFunction("CUSTOMUNDO"); // CUSTOMUNDO retval[240] = new NotImplementedFunction("CUSTOMREPEAT"); // CUSTOMREPEAT retval[241] = new NotImplementedFunction("FORMULAConvert"); // FORMULAConvert retval[242] = new NotImplementedFunction("GetLINKINFO"); // GetLINKINFO retval[243] = new NotImplementedFunction("TEXTBOX"); // TEXTBOX retval[244] = new NotImplementedFunction("INFO"); // INFO retval[245] = new NotImplementedFunction("GROUP"); // GROUP retval[246] = new NotImplementedFunction("GetOBJECT"); // GetOBJECT retval[247] = new NotImplementedFunction("DB"); // DB retval[248] = new NotImplementedFunction("PAUSE"); // PAUSE retval[250] = new NotImplementedFunction("RESUME"); // RESUME retval[252] = new NotImplementedFunction("FREQUENCY"); // FREQUENCY retval[253] = new NotImplementedFunction("AddTOOLBAR"); // AddTOOLBAR retval[254] = new NotImplementedFunction("DELETETOOLBAR"); // DELETETOOLBAR retval[FunctionID.EXTERNAL_FUNC] = null; // ExternalFunction is a FreeREfFunction retval[256] = new NotImplementedFunction("RESetTOOLBAR"); // RESetTOOLBAR retval[257] = new NotImplementedFunction("EVALUATE"); // EVALUATE retval[258] = new NotImplementedFunction("GetTOOLBAR"); // GetTOOLBAR retval[259] = new NotImplementedFunction("GetTOOL"); // GetTOOL retval[260] = new NotImplementedFunction("SPELLINGCHECK"); // SPELLINGCHECK retval[261] = new Errortype(); // ERRORTYPE retval[262] = new NotImplementedFunction("APPTITLE"); // APPTITLE retval[263] = new NotImplementedFunction("WINDOWTITLE"); // WINDOWTITLE retval[264] = new NotImplementedFunction("SAVETOOLBAR"); // SAVETOOLBAR retval[265] = new NotImplementedFunction("ENABLETOOL"); // ENABLETOOL retval[266] = new NotImplementedFunction("PRESSTOOL"); // PRESSTOOL retval[267] = new NotImplementedFunction("REGISTERID"); // REGISTERID retval[268] = new NotImplementedFunction("GetWORKBOOK"); // GetWORKBOOK retval[269] = AggregateFunction.AVEDEV; // AVEDEV retval[270] = new NotImplementedFunction("BETADIST"); // BETADIST retval[271] = new NotImplementedFunction("GAMMALN"); // GAMMALN retval[272] = new NotImplementedFunction("BETAINV"); // BETAINV retval[273] = new NotImplementedFunction("BINOMDIST"); // BINOMDIST retval[274] = new NotImplementedFunction("CHIDIST"); // CHIDIST retval[275] = new NotImplementedFunction("CHIINV"); // CHIINV retval[276] = NumericFunction.COMBIN; // COMBIN retval[277] = new NotImplementedFunction("CONFIDENCE"); // CONFIDENCE retval[278] = new NotImplementedFunction("CRITBINOM"); // CRITBINOM retval[279] = new Even(); // EVEN retval[280] = new NotImplementedFunction("EXPONDIST"); // EXPONDIST retval[281] = new NotImplementedFunction("FDIST"); // FDIST retval[282] = new NotImplementedFunction("FINV"); // FINV retval[283] = new NotImplementedFunction("FISHER"); // FISHER retval[284] = new NotImplementedFunction("FISHERINV"); // FISHERINV retval[285] = NumericFunction.FLOOR; // FLOOR retval[286] = new NotImplementedFunction("GAMMADIST"); // GAMMADIST retval[287] = new NotImplementedFunction("GAMMAINV"); // GAMMAINV retval[288] = NumericFunction.CEILING; // CEILING retval[289] = new NotImplementedFunction("HYPGEOMDIST"); // HYPGEOMDIST retval[290] = new NotImplementedFunction("LOGNORMDIST"); // LOGNORMDIST retval[291] = new NotImplementedFunction("LOGINV"); // LOGINV retval[292] = new NotImplementedFunction("NEGBINOMDIST"); // NEGBINOMDIST retval[293] = new NotImplementedFunction("NORMDIST"); // NORMDIST retval[294] = new NotImplementedFunction("NORMSDIST"); // NORMSDIST retval[295] = new NotImplementedFunction("NORMINV"); // NORMINV retval[296] = new NotImplementedFunction("NORMSINV"); // NORMSINV retval[297] = new NotImplementedFunction("STANDARDIZE"); // STANDARDIZE retval[298] = new Odd(); // ODD retval[299] = new NotImplementedFunction("PERMUT"); // PERMUT retval[300] = NumericFunction.POISSON; // POISSON retval[301] = new NotImplementedFunction("TDIST"); // TDIST retval[302] = new NotImplementedFunction("WEIBULL"); // WEIBULL retval[303] = new Sumxmy2(); // SUMXMY2 retval[304] = new Sumx2my2(); // SUMX2MY2 retval[305] = new Sumx2py2(); // SUMX2PY2 retval[306] = new NotImplementedFunction("CHITEST"); // CHITEST retval[307] = new NotImplementedFunction("CORREL"); // CORREL retval[308] = new NotImplementedFunction("COVAR"); // COVAR retval[309] = new NotImplementedFunction("FORECAST"); // FORECAST retval[310] = new NotImplementedFunction("FTEST"); // FTEST retval[311] = new Intercept(); // INTERCEPT retval[312] = new NotImplementedFunction("PEARSON"); // PEARSON retval[313] = new NotImplementedFunction("RSQ"); // RSQ retval[314] = new NotImplementedFunction("STEYX"); // STEYX retval[315] = new Slope(); // SLOPE retval[316] = new NotImplementedFunction("TTEST"); // TTEST retval[317] = new NotImplementedFunction("PROB"); // PROB retval[318] = AggregateFunction.DEVSQ; // DEVSQ retval[319] = new NotImplementedFunction("GEOMEAN"); // GEOMEAN retval[320] = new NotImplementedFunction("HARMEAN"); // HARMEAN retval[321] = AggregateFunction.SUMSQ; // SUMSQ retval[322] = new NotImplementedFunction("KURT"); // KURT retval[323] = new NotImplementedFunction("SKEW"); // SKEW retval[324] = new NotImplementedFunction("ZTEST"); // ZTEST retval[325] = AggregateFunction.LARGE; // LARGE retval[326] = AggregateFunction.SMALL; // SMALL retval[327] = new NotImplementedFunction("QUARTILE"); // QUARTILE retval[328] = AggregateFunction.PERCENTILE; // PERCENTILE retval[329] = new NotImplementedFunction("PERCENTRANK"); // PERCENTRANK retval[330] = new Mode(); // MODE retval[331] = new NotImplementedFunction("TRIMMEAN"); // TRIMMEAN retval[332] = new NotImplementedFunction("TINV"); // TINV retval[334] = new NotImplementedFunction("MOVIECOMMAND"); // MOVIECOMMAND retval[335] = new NotImplementedFunction("GetMOVIE"); // GetMOVIE retval[336] = TextFunction.CONCATENATE; // CONCATENATE retval[337] = NumericFunction.POWER; // POWER retval[338] = new NotImplementedFunction("PIVOTAddDATA"); // PIVOTAddDATA retval[339] = new NotImplementedFunction("GetPIVOTTABLE"); // GetPIVOTTABLE retval[340] = new NotImplementedFunction("GetPIVOTFIELD"); // GetPIVOTFIELD retval[341] = new NotImplementedFunction("GetPIVOTITEM"); // GetPIVOTITEM retval[342] = NumericFunction.RADIANS; ; // RADIANS retval[343] = NumericFunction.DEGREES; // DEGREES retval[344] = new Subtotal(); // SUBTOTAL retval[345] = new Sumif(); // SUMIF retval[346] = new Countif(); // COUNTIF retval[347] = new Countblank(); // COUNTBLANK retval[348] = new NotImplementedFunction("SCENARIOGet"); // SCENARIOGet retval[349] = new NotImplementedFunction("OPTIONSLISTSGet"); // OPTIONSLISTSGet retval[350] = new NotImplementedFunction("IsPMT"); // IsPMT retval[351] = new NotImplementedFunction("DATEDIF"); // DATEDIF retval[352] = new NotImplementedFunction("DATESTRING"); // DATESTRING retval[353] = new NotImplementedFunction("NUMBERSTRING"); // NUMBERSTRING retval[354] = new Roman(); // ROMAN retval[355] = new NotImplementedFunction("OPENDIALOG"); // OPENDIALOG retval[356] = new NotImplementedFunction("SAVEDIALOG"); // SAVEDIALOG retval[357] = new NotImplementedFunction("VIEWGet"); // VIEWGet retval[358] = new NotImplementedFunction("GetPIVOTDATA"); // GetPIVOTDATA retval[359] = new Hyperlink(); // HYPERLINK retval[360] = new NotImplementedFunction("PHONETIC"); // PHONETIC retval[361] = new NotImplementedFunction("AVERAGEA"); // AVERAGEA retval[362] = MinaMaxa.MAXA; // MAXA retval[363] = MinaMaxa.MINA; // MINA retval[364] = new NotImplementedFunction("STDEVPA"); // STDEVPA retval[365] = new NotImplementedFunction("VARPA"); // VARPA retval[366] = new NotImplementedFunction("STDEVA"); // STDEVA retval[367] = new NotImplementedFunction("VARA"); // VARA return(retval); }
public static Int32 ToInt(this Rank r) { return((Int32)r); }
public static string USI(Rank r) { return(((char)(r.ToInt() + 'a')).ToString()); }
public static int Create(Rank rank, Suit suit) { return((int)suit * 10 + (int)rank); }
public override string ToString() { return(Rank.ToString() + " of " + Suit.ToString()); }
public Card(Suit suit, Rank rank) { this.suit = suit; this.rank = rank; }
public Card(Suit suit, Rank rank) { CreateMaps(); this.SuitValue = suit; this.RankValue = rank; }
public Card(Rank rank) : this(GetRandomSuit(), rank) { }
public bool ChangeRank(PlayerObject Self, string membername, byte RankIndex, string RankName = "Members") { if ((Self.MyGuild != this) || (Self.MyGuildRank == null)) { return(false); } if (RankIndex >= Ranks.Count) { return(false); } GuildMember Member = null; Rank MemberRank = null; for (int i = 0; i < Ranks.Count; i++) { for (int j = 0; j < Ranks[i].Members.Count; j++) { if (Ranks[i].Members[j].name == membername) { Member = Ranks[i].Members[j]; MemberRank = Ranks[i]; goto Found; } } } Found: if (Member == null) { return(false); } MirDatabase.CharacterInfo Character = Envir.GetCharacterInfo(membername); if (Character == null) { return(false); } if ((RankIndex == 0) && (Character.Level < Settings.Guild_RequiredLevel)) { Self.ReceiveChat(String.Format("A guild leader needs to be at least level {0}", Settings.Guild_RequiredLevel), ChatType.System); return(false); } if ((MemberRank.Index >= Self.MyGuildRank.Index) && (Self.MyGuildRank.Index != 0)) { return(false); } if (MemberRank.Index == 0) { if (MemberRank.Members.Count <= 2) { Self.ReceiveChat("A guild needs at least 2 leaders.", ChatType.System); return(false); } for (int i = 0; i < MemberRank.Members.Count; i++) { if ((MemberRank.Members[i].Player != null) && (MemberRank.Members[i] != Member)) { goto AllOk; } } Self.ReceiveChat("You need at least 1 leader online.", ChatType.System); return(false); } AllOk: Ranks[RankIndex].Members.Add(Member); MemberRank.Members.Remove(Member); MemberRank = Ranks[RankIndex]; List <Rank> NewRankList = new List <Rank>(); NewRankList.Add(Ranks[RankIndex]); NeedSave = true; PlayerObject player = (PlayerObject)Member.Player; if (player != null) { player.MyGuildRank = Ranks[RankIndex]; player.Enqueue(new ServerPackets.GuildMemberChange() { Name = Self.Info.Name, Status = (byte)8, Ranks = NewRankList }); player.BroadcastInfo(); } for (int i = 0; i < Ranks.Count; i++) { for (int j = 0; j < Ranks[i].Members.Count; j++) { if ((Ranks[i].Members[j].Player != null) && (Ranks[i].Members[j].Player != Member.Player)) { player = (PlayerObject)Ranks[i].Members[j].Player; player.Enqueue(new ServerPackets.GuildMemberChange() { Name = Member.name, Status = (byte)5, RankIndex = (byte)MemberRank.Index }); player.GuildMembersChanged = true; } } } return(true); }
/// <summary> /// Updates the HUD elements. /// </summary> /// <param name="level">The current level.</param> /// <param name="score">The player's score.</param> /// <param name="rank">The player's rank.</param> public void UpdateHUD(int level, int score, Rank rank) { ShowLevel(level); ShowScore(score); ShowRank(rank); }
public Card(Rank rank, Suit suit) { this.rank = rank; this.suit = suit; }
// set up the position given the FEN.split(' ') public Position ParseFen(string[] fen) { Position position = new Position(); ResetBoard(position); if (fen.Length < 4 || fen.Length > 6) { Console.WriteLine("FEN ERROR: Invalid Format"); return(null); } // location Rank rank = Rank.Rank_8; File file = File.File_A; // piece type Piece piece = Piece.INVALID; // how many consecrative empty spaces int count = 0; #region piece positions // piece positions foreach (char letter in fen[0]) { // move one square minimum for each character count = 1; switch (letter) { case 'p': piece = Piece.bP; break; case 'r': piece = Piece.bR; break; case 'n': piece = Piece.bN; break; case 'b': piece = Piece.bB; break; case 'q': piece = Piece.bQ; break; case 'k': piece = Piece.bK; break; case 'P': piece = Piece.wP; break; case 'R': piece = Piece.wR; break; case 'N': piece = Piece.wN; break; case 'B': piece = Piece.wB; break; case 'Q': piece = Piece.wQ; break; case 'K': piece = Piece.wK; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': piece = Piece.EMPTY; count = int.Parse(letter.ToString()); //count = (int)(letter - '0'); break; case '/': rank--; file = File.File_A; continue; default: Console.WriteLine("FEN ERROR: Invalid Character"); return(null); } for (int i = 0; i < count; i++) { if (piece != Piece.EMPTY) { position.pieceTypeBySquare[(int)FileRanktoSquare(file, rank)] = piece; } file++; } } #endregion #region active color if (fen[1] == "w") { position.side = Color.w; } else if (fen[1] == "b") { position.side = Color.b; } else { Console.WriteLine("FEN ERROR: Invalid Color"); return(null); } #endregion #region castling availability // castle foreach (char character in fen[2]) { switch (character) { case 'K': position.castlePerm |= (int)Castle.WKCA; break; case 'Q': position.castlePerm |= (int)Castle.WQCA; break; case 'k': position.castlePerm |= (int)Castle.BKCA; break; case 'q': position.castlePerm |= (int)Castle.BQCA; break; case '-': break; default: Console.WriteLine("FEN ERROR: Invalid Castle"); return(null); } } #endregion #region en passant if (fen[3] != "-") { // convert char to int and cast to enum // from char to int to File type file = (File)((int)(((fen[3])[0]) - 'a')); // from number to Rank rank = (Rank)(int.Parse(((fen[3])[1]).ToString()) - 1); position.enPas = FileRanktoSquare(file, rank); } #endregion #region fifty move position.fiftyMoveCounter = int.Parse(fen[4]); #endregion // generate hash key for this position position.positionKey = GeneratePositionKey(position); UpdateMaterialLists(position); return(position); }
/// <summary> /// evaluates a 5 card hand and returns info about the ranking /// </summary> /// <param name="hand"></param> /// <returns></returns> public Rank Evaluate(List <Card> hand) { //info about the ranking of the hand Rank rank = new Rank(); //basic check for null and 5 cards if (!CheckHand(hand)) { return(rank); } //ace is 1 only if its a 5 4 2 3 1 straight //it defaults to 14 so we adjust it here for this one specific case //where the ace is not the high card in the hand AdjustForAceLowStraight(ref hand); //sort the cards descending List <Card> sortedhand = hand.OrderByDescending(x => x.Value).ToList(); if (IsRoyalFlush(sortedhand, ref rank)) { return(rank); } if (IsStraightFlush(sortedhand, ref rank)) { return(rank); } if (Is4ofAKind(sortedhand, ref rank)) { return(rank); } if (IsFullHouse(sortedhand, ref rank)) { return(rank); } if (IsFlush(sortedhand, ref rank)) { return(rank); } if (IsStraight(sortedhand, ref rank)) { return(rank); } if (Is3ofAKind(sortedhand, ref rank)) { return(rank); } if (Is2Pair(sortedhand, ref rank)) { return(rank); } if (IsPair(sortedhand, ref rank)) { return(rank); } if (IsHighCard(sortedhand, ref rank)) { return(rank); } return(rank); }
public static bool CanPromote(Color c, Rank r) { return(r == (c == Color.BLACK ? Rank.RANK_1 : Rank.RANK_5)); }
public Player(Rank rank) : this(rank, false) { // None }
public Sport(string n, string c, int a, Rank r) : base(n, c) { Age = a; Rank = r; }
public Card(Suit newSuit, Rank newRank) { suit = newSuit; rank = newRank; }
public Card(Suit suit, Rank rank) { this.suit = suit; this.rank = rank; this.avatar = suit.ToString() + rank.ToString(); }
public Missed(Rank rank, Suit suit) : base(CardType.Missed, rank, suit) { }
public override int GetHashCode() { return((Suit == null ? 32 : Suit.GetHashCode()) ^ (Rank == null ? 3 : Rank.GetHashCode()) * DeckId.GetHashCode()); }
//------------------------------------------------------------------------------------ /// <summary> /// Get a printable character for a rank /// </summary> //------------------------------------------------------------------------------------ public static char GetRankChar(Rank rank) { return(rank == Rank._10 ? 'T' : rank.ToString().Trim('_')[0]); }
// Spell cards are rank <= -2 Sprite GetRuin(Rank rank) { return(RuinSprites[(-(int)rank) - 2]); }
public static string Pretty(this Rank r) { return(RankToString[(int)r]); }
private async Task CheckFollower(string chatter, string userTwitchId) { try { TwitchChatter follower = await GetTwitchFollowerInfo(chatter, userTwitchId); if (follower == null) { return; } // check if follower has experience int currentExp = await _follower.CurrentExp(chatter, _broadcasterId); decimal hoursWatched = 0.0m; if (currentExp > -1) { await _follower.UpdateExp(chatter, _broadcasterId, ++currentExp); // check if user has been promoted Rank capRank = _rankList.FirstOrDefault(r => r.ExpCap == currentExp); hoursWatched = _follower.GetHoursWatched(currentExp); if (hoursWatched == _botConfig.RegularFollowerHours) { Rank currentRank = _follower.GetCurrentRank(_rankList, currentExp); _irc.SendPublicChatMessage($"{currentRank.Name} {chatter} has achieved the salty equlibrium " + "needed to become a regular soldier in the salt army"); } else if (capRank != null) { Rank currentRank = _follower.GetCurrentRank(_rankList, currentExp); _irc.SendPublicChatMessage($"@{chatter} has been promoted to \"{currentRank.Name}\" " + $"with {currentExp}/{currentRank.ExpCap} EXP ({hoursWatched} hours watched)"); } } else { // add new user to the ranks await _follower.EnlistRecruit(chatter, _broadcasterId); } // check if follower has a stream currency account int funds = await _bank.CheckBalance(chatter, _broadcasterId); if (funds > -1) { if (hoursWatched >= _botConfig.RegularFollowerHours) { funds += 15; if (!_twitchChatterListInstance.TwitchRegularFollowers.Any(c => c.Username.Equals(chatter))) { _twitchChatterListInstance.TwitchRegularFollowers.Add(follower); } } else { funds += 10; } await _bank.UpdateFunds(chatter, _broadcasterId, funds); } else // ToDo: Make currency auto-increment setting { await _bank.CreateAccount(chatter, _broadcasterId, 10); } } catch (Exception ex) { Console.WriteLine("Error inside FollowerSubscriberListener.CheckFollower(string, string): " + ex.Message); if (ex.InnerException != null) { Console.WriteLine($"Inner Exception: {ex.InnerException.Message}"); } } }
public static Square MakeSquare(File f, Rank r) { return((Square)(f.ToInt() * 5 + r.ToInt())); }
static void Main() { string playerOne = Console.ReadLine(); string playerTwo = Console.ReadLine(); List <Card> cardsPlayerOne = new List <Card>(); List <Card> cardsPlayerTwo = new List <Card>(); while (cardsPlayerOne.Count != 5) { string[] inputCard = Console.ReadLine().Split(' ').ToArray(); string rank = inputCard[0]; string suit = inputCard[2]; try { Rank r = (Rank)Enum.Parse(typeof(Rank), rank); Suits suits = (Suits)Enum.Parse(typeof(Suits), suit); Card card = new Card(r, suits); if (cardsPlayerOne.Any(c => c.Rank == card.Rank && c.Suit == card.Suit)) { Console.WriteLine("Card is not in the deck."); } else { cardsPlayerOne.Add(card); } } catch (Exception e) { Console.WriteLine("No such card exists."); } } while (cardsPlayerTwo.Count != 5) { string[] inputCard = Console.ReadLine().Split(' ').ToArray(); string rank = inputCard[0]; string suit = inputCard[2]; try { Rank r = (Rank)Enum.Parse(typeof(Rank), rank); Suits suits = (Suits)Enum.Parse(typeof(Suits), suit); Card card = new Card(r, suits); if (cardsPlayerOne.Any(c => c.Rank == card.Rank && c.Suit == card.Suit) || cardsPlayerTwo.Any(c => c.Rank == card.Rank && c.Suit == card.Suit)) { Console.WriteLine("Card is not in the deck."); } else { cardsPlayerTwo.Add(card); } } catch (Exception e) { Console.WriteLine("No such card exists."); } } Card bigestCardPlayerOne = cardsPlayerOne.OrderByDescending(c => c.power).FirstOrDefault(); Card biggestCardPlayerTwo = cardsPlayerTwo.OrderByDescending(c => c.power).FirstOrDefault(); if (bigestCardPlayerOne.power > biggestCardPlayerTwo.power) { Console.WriteLine(playerOne + " wins with " + bigestCardPlayerOne.Rank + " of " + bigestCardPlayerOne.Suit + "."); } else { Console.WriteLine(playerTwo + " wins with " + biggestCardPlayerTwo.Rank + " of " + biggestCardPlayerTwo.Suit + "."); } }