Last active
August 29, 2015 14:08
-
-
Save paralleltree/b9749395417e32ff372c to your computer and use it in GitHub Desktop.
CODE RUNNER 予選B
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net; | |
class Nyan | |
{ | |
string attack = "https://game.coderunner.jp/attack?token=xxxxxxxx&skill={0}"; | |
void Work() | |
{ | |
var rnd = new Random(); | |
int max = 0; | |
int skill = 0; | |
bool combo = false; | |
while (true) | |
{ | |
int input = rnd.Next(100); | |
int result = int.Parse(Query(string.Format(attack, input.ToString()))); | |
if (result > max) | |
{ | |
max = result; | |
skill = input; | |
Console.ForegroundColor = ConsoleColor.Red; | |
combo = true; | |
} | |
Console.WriteLine("{0:00} {1}", input, result); | |
System.Threading.Thread.Sleep(1000); | |
Console.ForegroundColor = ConsoleColor.Gray; | |
if (!combo || max < 1000) continue; | |
while (true) | |
{ | |
result = int.Parse(Query(string.Format(attack, skill))); | |
Console.WriteLine("{0:00} {1}", skill, result); | |
System.Threading.Thread.Sleep(1000); | |
if (result < max) | |
{ | |
max = result; | |
combo = false; | |
break; | |
} | |
} | |
} | |
} | |
string Query(string uri) | |
{ | |
var wc = new WebClient(); | |
return wc.DownloadString(uri); | |
} | |
static void Main(string[] args) | |
{ | |
new Nyan().Work(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment