public static int CalculateFight(int[] player1, int[] player2, int seed, int steps = 3) { int player = new LinearConRng(seed).NextInt(0, 2); Player player_1 = new Player(); Player player_2 = new Player(); Debug.Log("Player RND : " + player); for (int i = 0; i < steps; i++) { for (int j = 0; j < 2; j++) { if (player == 0) { UseSkill(player_1, player_2, player, player1[i], steps - i, FindObjectOfType <Skills>().skills); Debug.Log("Player2 HP : " + player_2.HP); if (player_2.HP <= 0) { return(player); } player = NextPlayer(player); } else { UseSkill(player_1, player_2, player, player2[i], steps - i, FindObjectOfType <Skills>().skills); Debug.Log("Player1 HP : " + player_1.HP); if (player_1.HP <= 0) { return(player); } player = NextPlayer(player); } } } return(2); }
public void Load(SkillsPlayer skillsplayer, List <Players> players, List <Txs> txs, int height, string address) { for (int i = 0; i < txs.Count; i++) { players = GetPlayers(address, txs[i].Height); if (!txs[i].Sender) { List <Players> _players = GetPlayers(txs[i].AddressSender, txs[i].Height); int seed = int.Parse(AttachmentBase58.HexToDecimal(AttachmentBase58.Base58NumericDecode(txs[i].Tx.Substring(0, 4)))); LinearConRng rnd = new LinearConRng(seed); int enemy = rnd.NextInt(0, _players.Count); SkillsPlayer skillsEnemy = AddressSkills(txs[i].AddressSender, txs[i].Height); if (_players[enemy].Address == address && skillsEnemy.Height <= txs[i].Height) { var panelGO = Instantiate(GameHistory, transform); panelGO.GetComponent <GameHistoryPanel>().SetStats(txs[i].Tx, txs[i].AddressSender, skillsplayer.Skills, skillsEnemy.Skills, Convert.ToInt32(txs[i].Sender)); panels.Add(panelGO); } } else { int seed = int.Parse(AttachmentBase58.HexToDecimal(AttachmentBase58.Base58NumericDecode(txs[i].Tx.Substring(0, 4)))); LinearConRng rnd = new LinearConRng(seed); int enemy = rnd.NextInt(0, players.Count); SkillsPlayer skillsEnemy = AddressSkills(players[enemy].Address, txs[i].Height); if (skillsEnemy.Height <= txs[i].Height) { var panelGO = Instantiate(GameHistory, transform); panelGO.GetComponent <GameHistoryPanel>().SetStats(txs[i].Tx, players[enemy].Address, skillsplayer.Skills, players[enemy].Skills, Convert.ToInt32(txs[i].Sender)); panels.Add(panelGO); } } } }
public void Run() { Console.WriteLine("Testing RNGs...\n"); var rnd = new Random(); var seed = rnd.Next(); var wichSeed = rnd.Next(30000); var lehmerRng = new LehmerRng(seed); var wichmannRng = new WichmannRng(wichSeed); var linearConRng = new LinearConRng(seed); var buildInRng = new BuildInRng(); var result = new TotalResults { ChiTestResults = new List <ChiTestResult> { _testRng.ChiTest(buildInRng), _testRng.ChiTest(lehmerRng), _testRng.ChiTest(wichmannRng), _testRng.ChiTest(linearConRng) }, MeanTestResults = new List <MeanTestResult> { _testRng.MeanTest(buildInRng), _testRng.MeanTest(lehmerRng), _testRng.MeanTest(wichmannRng), _testRng.MeanTest(linearConRng) }, TimeTestResults = new List <TimeTestResult> { _testRng.TimeTest(buildInRng), _testRng.TimeTest(lehmerRng), _testRng.TimeTest(wichmannRng), _testRng.TimeTest(linearConRng) }, StandardDeviationTestResults = new List <StandardDeviationTestResult> { _testRng.StandardDeviationTest(buildInRng), _testRng.StandardDeviationTest(lehmerRng), _testRng.StandardDeviationTest(wichmannRng), _testRng.StandardDeviationTest(linearConRng) } }; _outputBuilder.WriteOutput(result); Console.ReadLine(); }