/// <summary> /// TODO: FIXME /// </summary> /// <param name="team"></param> /// <returns></returns> public string GetOLineString(Team team) { // Player t1,t2,t3,t4,g1,g2,g3,g4,c1,c2; // t1=t2=t3=t4=g1=g2=g3=g4=c1=c2=null; int t_count = team.CountPositions("T"); int c_count = team.CountPositions("C"); int g_count = team.CountPositions("G"); int max, min; max= min=0; if(team.offenseRank < 5){ min = 0; max = 40; } else if(team.offenseRank < 10){ min = 40; max = 60; } else if( team.offenseRank < 15){ min = 60; max = 80; } else if(team.offenseRank < 20){ min = 80; max = 160; } else //if(team.offenseRank < 28) { min = 160; max = 309;// TSBData.OLmen.Length; } //ranking = min + (((c1.fname.Length + c1.lname.Length ) * 3 ) % 15 ); //c2 = team.GetPlayer("C",null,null,null,2); //sb.Append(GetOLPlayerString(c1,"C",cd)); StringBuilder sb = new StringBuilder(500); int ranking = 0; Player p; for(int i = 1; i < 11; i++ ) { p = team.GetPlayer("C","T","G",null,i); if( p.lname == "Nobody") break; if( p.StarterPosition != null ) { ranking = min + (((p.fname.Length + p.lname.Length ) * 3 ) % 15 ); } else { ranking = (min + 50) + (((p.fname.Length + p.lname.Length ) * 3 ) % 15 ); } sb.Append(GetOLPlayerString(p, p.position,ranking)); team.AddOffensiveLinemanToDepthChart(p); } string ret = sb.ToString(); return ret; }
public string GetKickerPunterString(Team team) { Player k, p; k = team.GetPlayer("K",null,null,null,1); if(k.position == "X") k.skinColor = 1; p = team.GetPlayer("P",null,null,null,1); if(p.position == "X") p.skinColor = 1; string k_str = GetPlayerString(k); string p_str = GetPlayerString(p); team.AddPlayerToDepthChart("K",k); team.AddPlayerToDepthChart("P",p); return k_str + p_str; }
/// <summary> /// Returns an array of 2 strings. /// ret[0] = the offensive string. /// ret[1] = the KR_PR string. /// </summary> /// <param name="team"></param> /// <returns></returns> public string GetOffensiveSkillPlayerString(Team team) { Player qb1,qb2,qb3,rb1,rb2,rb3,rb4,rb5,rb6,wr1,wr2,wr3, wr4,wr5, //wr6,wr7, te1,te2,te3 //,te4 =null; rb1=rb2=rb3=rb4=rb5=rb6=null; int fb_count = team.CountPositions("FB"); if( fb_count > 3 ) fb_count = 3; qb1 = team.GetQBPlayer(1); qb2 = team.GetQBPlayer(2); qb3 = team.GetQBPlayer(3); //What's this for? // if(qb2.ranking < qb1.ranking && qb1.passingYards > qb2.passingYards) // { // qb2.ranking = qb1.ranking + 5; // } if(qb2 == null) rb1=null; rb1 = team.GetPlayer("RB","HB",null,null,1); switch(fb_count) { case 0: rb2 = team.GetPlayer("RB","HB",null,null,2); rb3 = team.GetPlayer("RB","HB",null,null,3); rb4 = team.GetPlayer("RB","HB",null,null,4); rb5 = team.GetPlayer("RB","HB",null,null,5); rb6 = team.GetPlayer("RB","HB",null,null,6); break; case 1: rb2 = team.GetPlayer("FB",null,null,null,1); rb3 = team.GetPlayer("RB","HB",null,null,2); rb4 = team.GetPlayer("RB","HB",null,null,3); rb5 = team.GetPlayer("RB","HB",null,null,4); rb6 = team.GetPlayer("RB","HB",null,null,5); break; case 2: rb2 = team.GetPlayer("FB",null,null,null,1); rb3 = team.GetPlayer("RB","HB",null,null,2); rb4 = team.GetPlayer("FB",null,null,null,2); rb5 = team.GetPlayer("RB","HB",null,null,3); rb6 = team.GetPlayer("RB","HB",null,null,4); break; case 3: rb2 = team.GetPlayer("FB",null,null,null,1); rb3 = team.GetPlayer("RB","HB",null,null,2); rb4 = team.GetPlayer("FB",null,null,null,2); rb5 = team.GetPlayer("RB","HB",null,null,3); rb6 = team.GetPlayer("FB",null,null,null,3); break; } int wr_count = 1; wr1 = team.GetPlayer("WR",null,null,null,wr_count++); wr2 = team.GetPlayer("WR",null,null,null,wr_count++); wr3 = team.GetPlayer("WR",null,null,null,wr_count++); wr4 = team.GetPlayer("WR",null,null,null,wr_count++); wr5 = team.GetPlayer("WR",null,null,null,wr_count++); //wr6 = team.GetPlayer("WR",null,null,null,wr_count++); //wr7 = team.GetPlayer("WR",null,null,null,wr_count++); te1 = team.GetPlayer("TE",null,null,null,1); te2= team.GetPlayer("TE",null,null,null,2); te3 = team.GetPlayer("TE",null,null,null,3); // te4 = team.GetPlayer("TE",null,null,null,4); //Take care of run+ shoot teams if(rb2.lname.ToLower() == "nobody"){ rb2 = team.GetPlayer("WR",null,null,null,wr_count++); rb3 = team.GetPlayer("WR",null,null,null,wr_count++); rb4 = team.GetPlayer("WR",null,null,null,wr_count++); } else if(rb3.lname.ToLower() == "nobody"){ rb3 = team.GetPlayer("WR",null,null,null,wr_count++); rb4 = team.GetPlayer("WR",null,null,null,wr_count++); } else if(rb4.lname.ToLower() == "nobody"){ rb4 = team.GetPlayer("WR",null,null,null,wr_count++); } // take care of team with no or few tightends // if(te1.lname.ToLower() == "nobody"){ // te1 = team.GetPlayer("WR",null,null,null,wr_count++); // te2 = team.GetPlayer("WR",null,null,null,wr_count++); // } // else if(te2.lname.ToLower() == "nobody"){ // te2 = team.GetPlayer("WR",null,null,null,wr_count++); // } // make sure the guy with the most Rush yards starts at RB if( rb1.rushYards < rb3.rushYards ) { // swap players Player tmp; tmp = rb1; rb1 = rb3; rb3 = tmp; } StringBuilder sb = new StringBuilder(3000); //string ret = //string.Format( sb.Append( GetPlayerString(qb1)); team.AddPlayerToDepthChart("QB1", qb1); if( qb2.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(qb2)); team.AddPlayerToDepthChart("QB2",qb2); } if( qb3.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(qb3)); team.AddPlayerToDepthChart("QB3",qb3); } int numFullbacks=1; int numHalfbacks=2; sb.Append( GetPlayerString(rb1)); team.AddPlayerToDepthChart("HB1",rb1); sb.Append( GetPlayerString(rb2,"FB")); team.AddPlayerToDepthChart("FB1",rb2); sb.Append( GetPlayerString(rb3)); team.AddPlayerToDepthChart("HB2",rb3); team.DefaultReturnMan2 = rb3; if( rb4.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(rb4)); string rb4Pos = rb4.position; if( rb4Pos.StartsWith("FB")) { numFullbacks++; team.AddPlayerToDepthChart("FB"+numFullbacks,rb4); } else { numHalfbacks++; team.AddPlayerToDepthChart("HB"+numHalfbacks,rb4); } } if( rb5.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(rb5)); string rb5Pos = rb5.position; if( rb5Pos.StartsWith("FB")) { numFullbacks++; team.AddPlayerToDepthChart("FB"+numFullbacks,rb5); } else { numHalfbacks++; team.AddPlayerToDepthChart("HB"+numHalfbacks,rb5); } } // if( rb6.lname.ToLower() != "nobody" ) // sb.Append( GetPlayerString(rb6)); sb.Append( GetPlayerString(wr1)); team.AddPlayerToDepthChart("WR1",wr1); sb.Append( GetPlayerString(wr2)); team.AddPlayerToDepthChart("WR2",wr2); sb.Append( GetPlayerString(wr3)); team.AddPlayerToDepthChart("WR3",wr3); team.DefaultReturnMan1 = wr3; if( wr4.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(wr4)); team.AddPlayerToDepthChart("WR4",wr4); } if( wr5.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(wr5)); team.AddPlayerToDepthChart("WR5",wr5); } // if( wr6.lname.ToLower() != "nobody" ) // sb.Append( GetPlayerString(wr6)); // if( wr7.lname.ToLower() != "nobody" ) // sb.Append( GetPlayerString(wr7)); if( te1.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(te1)); team.AddPlayerToDepthChart("TE1",te1); } if( te2.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(te2)); team.AddPlayerToDepthChart("TE2",te2); } if( te3.lname.ToLower() != "nobody" ) { sb.Append( GetPlayerString(te3)); team.AddPlayerToDepthChart("TE3",te3); } // if( te4.lname.ToLower() != "nobody" ) // sb.Append( GetPlayerString(te4)); string ret = sb.ToString(); return ret; }
/// <summary> /// Still have defects here. /// Starting players may not start due to the initial ranking system. /// TODO: look into solving this problem in the 'Sort' Method. /// /// </summary> /// <param name="team"></param> /// <returns></returns> public string GetDefenseString(Team team) { Player de1,de2,de3,de4,dt1,dt2,dt3,dt4, olb1,olb2,olb3,olb4,ilb1,ilb2,ilb3,//ilb4, cb1,cb2,cb3,cb4,cb5,fs1,fs2,ss1,ss2; cb1=cb2=cb3=cb4=cb5=fs1=fs2=ss1=ss2 = null; ArrayList des = team.GetPlayersAtPositions(new string[] {"DE","DL"}); ArrayList dts = team.GetPlayersAtPositions(new string[] {"DT","NT","DL"}); ArrayList olbs = team.GetPlayersAtPositions(new string[] {"LB","OLB"}); ArrayList ilbs = team.GetPlayersAtPositions(new string[] {"LB","ILB","MLB"}); de1 = team.GetBestPlayer(des); des.Remove(de1);dts.Remove(de1); de2 = team.GetBestPlayer(des); des.Remove(de2);dts.Remove(de2); dt1 = team.GetBestPlayer(dts); des.Remove(dt1);dts.Remove(dt1); dt2 = team.GetBestPlayer(dts); des.Remove(dt2);dts.Remove(dt2); de3 = team.GetBestPlayer(des); des.Remove(de3);dts.Remove(de3); de4 = team.GetBestPlayer(des); des.Remove(de4);dts.Remove(de4); dt3 = team.GetBestPlayer(dts); des.Remove(dt3);dts.Remove(dt3); dt4 = team.GetBestPlayer(dts); des.Remove(dt4);dts.Remove(dt4); olb1 = team.GetBestPlayer(olbs); olbs.Remove(olb1);ilbs.Remove(olb1); olb2 = team.GetBestPlayer(olbs); olbs.Remove(olb2);ilbs.Remove(olb2); ilb1 = team.GetBestPlayer(ilbs); olbs.Remove(ilb1);ilbs.Remove(ilb1); ilb2 = team.GetBestPlayer(ilbs); olbs.Remove(ilb2);ilbs.Remove(ilb2); olb3 = team.GetBestPlayer(olbs); olbs.Remove(olb3);ilbs.Remove(olb3); olb4 = team.GetBestPlayer(olbs); olbs.Remove(olb4);ilbs.Remove(olb4); ilb3 = team.GetBestPlayer(ilbs); olbs.Remove(ilb3);ilbs.Remove(ilb3); // ilb4 = team.GetPlayer("LB",null,null,null,8); int s_count = team.CountPositions("S") + team.CountPositions("SS")+ team.CountPositions("FS"); if(s_count > 4 ) s_count = 4; switch(s_count) { case 0: cb1 = team.GetPlayer("CB","DB",null,null,1); cb2 = team.GetPlayer("CB","DB",null,null,2); cb3 = team.GetPlayer("CB","DB",null,null,5); cb4 = team.GetPlayer("CB","DB",null,null,6); fs1 = team.GetPlayer("CB","DB",null,null,3); ss1 = team.GetPlayer("CB","DB",null,null,4); fs2 = team.GetPlayer("CB","DB",null,null,7); ss2 = team.GetPlayer("CB","DB",null,null,8); cb5 = team.GetPlayer("CB","DB",null,null,9); break; case 1: cb1 = team.GetPlayer("CB","DB",null,null,1); cb2 = team.GetPlayer("CB","DB",null,null,2); cb3 = team.GetPlayer("CB","DB",null,null,4); cb4 = team.GetPlayer("CB","DB",null,null,5); fs1 = team.GetPlayer("S","SS","FS", null,1); ss1 = team.GetPlayer("CB","DB",null,null,3); fs2 = team.GetPlayer("CB","DB",null,null,6); ss2 = team.GetPlayer("CB","DB",null,null,7); cb5 = team.GetPlayer("CB","DB",null,null,8); break; case 2: cb1 = team.GetPlayer("CB","DB",null,null,1); cb2 = team.GetPlayer("CB","DB",null,null,2); cb3 = team.GetPlayer("CB","DB",null,null,3); cb4 = team.GetPlayer("CB","DB",null,null,4); fs1 = team.GetPlayer("S","SS","FS", null,1); ss1 = team.GetPlayer("S","SS","FS", null,2); fs2 = team.GetPlayer("CB","DB",null,null,5); ss2 = team.GetPlayer("CB","DB",null,null,6); cb5 = team.GetPlayer("CB","DB",null,null,7); break; case 3: cb1 = team.GetPlayer("CB","DB",null,null,1); cb2 = team.GetPlayer("CB","DB",null,null,2); cb3 = team.GetPlayer("CB","DB",null,null,3); cb4 = team.GetPlayer("CB","DB",null,null,4); fs1 = team.GetPlayer("S","SS","FS", null,1); ss1 = team.GetPlayer("S","SS","FS", null,2); fs2 = team.GetPlayer("S","SS","FS", null,3); ss2 = team.GetPlayer("CB","DB",null,null,5); cb5 = team.GetPlayer("CB","DB",null,null,6); break; case 4: cb1 = team.GetPlayer("CB","DB",null,null,1); cb2 = team.GetPlayer("CB","DB",null,null,2); cb3 = team.GetPlayer("CB","DB",null,null,3); cb4 = team.GetPlayer("CB","DB",null,null,4); fs1 = team.GetPlayer("S","SS","FS", null,1); ss1 = team.GetPlayer("S","SS","FS", null,2); fs2 = team.GetPlayer("S","SS","FS", null,3); ss2 = team.GetPlayer("S","SS","FS", null,4); cb5 = team.GetPlayer("CB","DB",null,null,5); break; } if(ss1.position == "CB"&& cb1.position == "DB"){ Player tmp = ss1; ss1 = cb1; ss1=tmp; } if(ss1.position == "CB"&& cb2.position == "DB"){ Player tmp = ss1; ss1 = cb2; ss1=tmp; } if(fs1.position == "CB"&& cb1.position == "DB"){ Player tmp = fs1; fs1 = cb1; fs1=tmp; } if(fs1.position == "CB"&& cb2.position == "DB"){ Player tmp = fs1; fs1 = cb2; fs1=tmp; } Player tmpPlayer; if(fs1.StarterPosition == "SS" || ss1.StarterPosition == "FS") { tmpPlayer = fs1; fs1 = ss1; ss1 = tmpPlayer; } StringBuilder sb = new StringBuilder(900); // defensive line if( de1 != null ) { sb.Append( GetPlayerString(de1,"DE")); team.AddPlayerToDepthChart("DE1",de1); } if( de2 != null) { sb.Append( GetPlayerString(de2,"DE")); team.AddPlayerToDepthChart("DE2",de2); } if( dt1 != null ) { sb.Append( GetPlayerString(dt1,"DT")); team.AddPlayerToDepthChart("DT1",dt1); } if( dt2 != null ) { sb.Append( GetPlayerString(dt2,"DT")); team.AddPlayerToDepthChart("DT2",dt2); } if(de3 != null) { //if( de3.lname != "Nobody") sb.Append( GetPlayerString(de3,"DE")); team.AddPlayerToDepthChart("DE3",de3); } if( de4 != null) { //if( de4.lname != "Nobody") sb.Append( GetPlayerString(de4,"DE")); team.AddPlayerToDepthChart("DE4",de4); } if(dt3 != null) { //if( dt3.lname != "Nobody") sb.Append( GetPlayerString(dt3,"DT")); team.AddPlayerToDepthChart("DT3",dt3); } if( dt4 != null) {//if( dt4.lname != "Nobody") sb.Append( GetPlayerString(dt4,"DT")); team.AddPlayerToDepthChart("DT4",dt4); } // linebackers sb.Append( GetPlayerString(olb1,"OLB")); team.AddPlayerToDepthChart("OLB1",olb1); sb.Append( GetPlayerString(olb2,"OLB")); team.AddPlayerToDepthChart("OLB2",olb2); sb.Append( GetPlayerString(ilb1,"ILB")); team.AddPlayerToDepthChart("ILB1",ilb1); sb.Append( GetPlayerString(ilb2,"ILB")); team.AddPlayerToDepthChart("ILB2",ilb2); if( olb3 != null) { sb.Append( GetPlayerString(olb3,"OLB")); team.AddPlayerToDepthChart("OLB3",olb3); } if( olb4 != null) { sb.Append( GetPlayerString(olb4,"OLB")); team.AddPlayerToDepthChart("OLB4",olb4); } if( ilb3 != null) { sb.Append( GetPlayerString(ilb3,"ILB")); team.AddPlayerToDepthChart("ILB3",ilb3); } // if( ilb4.lname != "Nobody") // sb.Append( GetPlayerString(ilb4,"ILB")); // defensive backs sb.Append( GetPlayerString(cb1,"CB")); team.AddPlayerToDepthChart("CB1",cb1); sb.Append( GetPlayerString(cb2,"CB")); team.AddPlayerToDepthChart("CB2",cb2); sb.Append( GetPlayerString(cb3,"CB")); team.AddPlayerToDepthChart("CB3",cb3); if( cb4.lname != "Nobody") { sb.Append( GetPlayerString(cb4,"CB")); team.AddPlayerToDepthChart("CB4",cb4); } if( cb5.lname != "Nobody") { sb.Append( GetPlayerString(cb5,"CB")); team.AddPlayerToDepthChart("CB5",cb5); } if( fs1.lname != "Nobody") { sb.Append( GetPlayerString(fs1,"FS")); team.AddPlayerToDepthChart("FS1",fs1); } if( ss1.lname != "Nobody") { sb.Append( GetPlayerString(ss1,"SS")); team.AddPlayerToDepthChart("SS1",ss1); } if( ss2.lname != "Nobody") { sb.Append( GetPlayerString(ss2,"SS")); team.AddPlayerToDepthChart("SS2",ss2); } if( fs2.lname != "Nobody") { sb.Append( GetPlayerString(fs2,"FS")); team.AddPlayerToDepthChart("FS2",fs2); } string ret = sb.ToString(); return ret; }