import java.util.Random;
public class Engine
{
PRivate int[] answer = new int[4];
private Random random = new Random();
public void init()
{
int[] number = new int[10];
for (int i = 0; i < number.length; i++)
{
number[i] = i;
}
int n = 10;
for (int index = 0; index < answer.length; index++)
{
int r = Math.abs(random.nextInt() % n);
answer[index] = number[r];
number[r] = number[n - 1];
n--;
}
}
public int[] getAnswer()
{
return answer;
}
public int[] queryResult(int[] input)
{
int[] state = new int[2];
int a = 0;
int b = 0;
for (int i = 0; i < answer.length; i++)
{
for (int j = 0; j < answer.length; j++)
{
if ((input[j] ^ answer[i]) == 0)
{
if (i == j)
{
a++;
} else
{
b++;
}
新闻热点
疑难解答