Exemplo n.º 1
0
    async Task organizeInitialCubes(int dimensionSize)
    {
        for (int i = 0; i < dimensionSize; i++)
        {
            await getIntegerFromServer();

            DenemeGameManagerScript gameManager = GetComponent <DenemeGameManagerScript>();
            gameManager.initialCubes[i] = replacerInt;
        }
    }
Exemplo n.º 2
0
    async Task organizeAnswerCubes(int dimensionSize)
    {
        for (int i = 0; i < dimensionSize; i++)
        {
            for (int j = 0; j < dimensionSize; j++)
            {
                await getIntegerFromServer();

                DenemeGameManagerScript gameManager = GetComponent <DenemeGameManagerScript>();
                gameManager.answerCubes[i, j] = replacerInt;
            }
        }
    }
Exemplo n.º 3
0
    public void setupSocket()
    {
        try{
            mySocket    = new TcpClient(Host, Port);
            theStream   = mySocket.GetStream();
            theWriter   = new StreamWriter(theStream);
            socketReady = true;
            theReader   = new StreamReader(theStream);

            Byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes("" + dim);
            theStream.Write(sendBytes, 0, sendBytes.Length);
            Debug.Log("socket is sent: " + dim);

            Byte[] probBytes = System.Text.Encoding.ASCII.GetBytes("" + prob);
            theStream.Write(probBytes, 0, probBytes.Length);
            Debug.Log("problem number is: " + prob);

            var expectedDim = Math.Pow(2, dim);

            for (int i = 0; i < expectedDim; i++)
            {
                var x = readPythonInt();
                DenemeGameManagerScript gameManager = GetComponent <DenemeGameManagerScript>();
                gameManager.initialCubes[i] = x;
            }


            for (int i = 0; i < expectedDim; i++)
            {
                for (int j = 0; j < expectedDim; j++)
                {
                    var x = readPythonInt();
                    DenemeGameManagerScript gameManager = GetComponent <DenemeGameManagerScript>();
                    gameManager.answerCubes[i, j] = x;
                }
            }

            mySocket.Close();
        }
        catch (Exception e) {
            Debug.Log("Socket error: " + e);
            //mySocket.Close();
        }
    }
Exemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     gameManager  = GetComponent <DenemeGameManagerScript>();
     currentScore = gameManager.currentScore;
     bestScore    = gameManager.currentScore;
 }
Exemplo n.º 5
0
 void Start()
 {
     gameManagerScript = gameManager.GetComponent <DenemeGameManagerScript> ();
     activateTerrain();
 }