更新:(C#)
字节数:3600
暴击:-25
所有p球:-91
总计= 3,484
[打高尔夫球]
using System;using System.Text;using System.Security.Cryptography;using System.Linq;namespace Pokemon{public class MainClass{private string[] c(string[] i){if(i.Length <= 3){var v1 =i[0][0];var v2 =i[1][0];var v3 =i[2][0];if(v1>='0'&&v1<='9'&&v2>='a'&&v2<='z'&&v3>='0'&&v3<='9')return new string[]{i[0],i[2],i[1]};else if(v1>='0'&&v1<='9'&&v2>='0'&&v2<='9'&&v3>='a'&&v3<='z')return new string[]{i[0],i[1],i[2]};else if(v1>='a'&&v1<='z'&&v2>='0'&&v2<='9'&&v3>='0'&&v3<='9')return new string[]{i[1],i[2],i[0]};else return null;}else return null;}private static void Main(string[] args){while(true){Console.Clear();MainClass _c = new MainClass();Console.Write("Inputs'please:");var i = Console.ReadLine().ToLower();string[] r = _c.c((string[])(i.Split(new Char[]{' ','.',',','\n','\t','!','@','#','$','%','^','&','&','*','(',')','-','_','+','=','?','/','\\'},StringSplitOptions.RemoveEmptyEntries).Select(p=>p.Trim()).ToList()).ToArray());new w("Processing...\n");if(r== null)new w("Too many errors");else new m(r);}}}public class w{public w(string l){Console.WriteLine(l);}}public class m{public m(string[] v){switch (v[2].Substring(0,2)){case "po":c(v[0],v[1],"1");break;case "ul":c(v[0],v[1],"2");break;case "ma":c(v[0],v[1],"255");break;case "gr":case "sa":case "sp":c(v[0],v[1],"1.5");break;case "lu":case "ne":c(v[0],v[1],"3");break;case "du":case "di":c(v[0],v[1],"3.5");break;case "mo":case "fa":c(v[0],v[1],"4");break;case "qu":c(v[0],v[1],"5");break;case "lo":c(v[0],v[1],"8");break;default:new w("Not supported");break;}}private double y(double v){return Convert.ToDouble(((double)1/(double)4096)*(v/Convert.ToDouble(1/4096)-(v%Convert.ToDouble(1/4096))));}private bool i(double v,double r,double b){if(((double)new Random().Next(0,(int)r))>b*v)return true;else return false;}private double f(double r, double h, double b){return 2.5*y((((3.0*h)-2.0)*r*b)/(3.0*h));}private void c(params string[] v){var s =0.0;var x =0;if(int.Parse(v[1])>100&&int.Parse(v[1])<= 255){s =f(double.Parse(v[0]),double.Parse(v[1]),double.Parse(v[2]));x=0;}else if(int.Parse(v[0])>100&&int.Parse(v[0])<= 255){s =f(double.Parse(v[1]),double.Parse(v[0]),double.Parse(v[2]));x=1;}else{new w(String.Format("Which number is the Max HP? :{0} or {1}:",v[0],v[1]));var c_ = int.Parse(Console.ReadLine());s =f((double.Parse(v[0])+double.Parse(v[1]))-double.Parse(v[c_]),double.Parse(v[c_]),double.Parse(v[2]));x=2;}if(((double)new Random().Next(0, 2047))<s*2.5)new w("*shake*\nClick!");else{for(int c_= 0;c_<3;c_++){new w("*shake*");var r =Math.Pow(65536.0/y(255.0/s),0.25);if(i(r,double.Parse(v[x]),2.5)==true){new w("Click!");break;}else;}}Console.ReadKey();}}}
[定期]
using System;
using System.Text;
using System.Security.Cryptography;
using System.Linq;
namespace Pokemon
{
public class MainClass
{
private string[] c(string[] i)
{
if (i.Length <= 3)
{
var v1 =i[0][0];
var v2 =i[1][0];
var v3 =i[2][0];
if(v1>='0'&&v1<='9'&&v2>='a'&&v2<='z'&&v3>='0'&&v3<='9')return new string[]{i[0],i[2],i[1]};
else if(v1>='0'&&v1<='9'&&v2>='0'&&v2<='9'&&v3>='a'&&v3<='z')return new string[]{i[0],i[1],i[2]};
else if(v1>='a'&&v1<='z'&&v2>='0'&&v2<='9'&&v3>='0'&&v3<='9')return new string[]{i[1],i[2],i[0]};
else return null;
}
else return null;
}
private static void Main(string[] args)
{
while(true)
{
Console.Clear();
MainClass _c = new MainClass();
Console.Write("Inputs'please:");
var i = Console.ReadLine().ToLower();
string[] r = _c.c((string[])(i.Split(new Char[]{' ','.',',','\n','\t','!','@','#','$','%','^','&','&','*','(',')','-','_','+','=','?','/','\\'},StringSplitOptions.RemoveEmptyEntries).Select(p=>p.Trim()).ToList()).ToArray());
new w("Processing...\n");
if(r== null)new w("Too many errors");
else new m(r);
}
}
}
public class w
{
public w(string l)
{
Console.WriteLine(l);
}
}
public class m
{
public m(string[] v)
{
switch (v[2].Substring(0,2))
{
case "po":
c(v[0],v[1],"1");
break;
case "ul":
c(v[0],v[1],"2");
break;
case "ma":
c(v[0],v[1],"255");
break;
case "gr":
case "sa":
case "sp":
c(v[0],v[1],"1.5");
break;
case "lu":
case "ne":
c(v[0],v[1],"3");
break;
case "du":
case "di":
c(v[0],v[1],"3.5");
break;
case "mo":
case "fa":
c(v[0],v[1],"4");
break;
case "qu":
c(v[0],v[1],"5");
break;
case "lo":
c(v[0],v[1],"8");
break;
default:
new w("Not supported");
break;
}
}
private double y(double v){return Convert.ToDouble(((double)1/(double)4096)*(v/Convert.ToDouble(1/4096)-(v%Convert.ToDouble(1/4096))));}
private bool i(double v,double r,double b){if(((double)new Random().Next(0,(int)r))>b*v)return true;else return false;}
private double f(double r, double h, double b){return 2.5*y((((3.0*h)-2.0)*r*b)/(3.0*h));}
private void c(params string[] v)
{
var s =0.0;
var x =0;
if(int.Parse(v[1])>100&&int.Parse(v[1])<= 255){s =f(double.Parse(v[0]),double.Parse(v[1]),double.Parse(v[2]));x=0;}
else if(int.Parse(v[0])>100&&int.Parse(v[0])<= 255){s =f(double.Parse(v[1]),double.Parse(v[0]),double.Parse(v[2]));x=1;}
else
{
new w(String.Format("Which number is the Max HP? :{0} or {1}:",v[0],v[1]));
var c_ = int.Parse(Console.ReadLine());
s =f((double.Parse(v[0])+double.Parse(v[1]))-double.Parse(v[c_]),double.Parse(v[c_]),double.Parse(v[2]));
x=2;
}
if (((double)new Random().Next(0, 2047))<s*2.5)new w("*shake*\nClick!");
else
{
for(int c_= 0;c_<3;c_++)
{
new w("*shake*");
var r =Math.Pow(65536.0/y(255.0/s),0.25);
if (i(r,double.Parse(v[x]),2.5)==true){new w("Click!");break;}else;
}
}
Console.ReadKey();
}
}
}
65536 / (255 / a)^(1/4)
但是我的胆量说它大于1。您是否检查0到65536之间的随机数?如果随机数较大或较小,检查是否成功?