//need to remember the changes/unchanges separately from locked positions (actually, we can basically just use this as--
    public void HandleChangeToLockedPosition(int position, char change, string targetState, char[] usersMostRecentChanges, ArduinoLetterController arduinoLetterController)
    {
        if (ACorrectLockedLetterWasChanged (position, targetState, usersMostRecentChanges, change)) {
                        lockedPositionStates [position] = IS_FILLED_WITH_WRONG_LETTER;
                        numCorrectLockedLettersThatUserChanged++;
                        if (numCorrectLockedLettersThatUserChanged == 1)
                                arduinoLetterController.LockAllLetters ();

                } else if (LockedLetterIsNowCorrect (change, targetState [position])) {
                        if (lockedPositionStates [position] == IS_FILLED_WITH_WRONG_LETTER) {
                                numCorrectLockedLettersThatUserChanged--;
                                if (numCorrectLockedLettersThatUserChanged == 0)
                                        arduinoLetterController.UnLockAllLetters ();

                        }
                        arduinoLetterController.UnLockASingleLetter (position);
                        lockedPositionStates [position] = IS_FILLED_WITH_CORRECT_LETTER;
                }
    }
    /* if it is activity mode, then we delegate control of the new letter to the student activity controller. otherwise just update all of the letters*/
    public void HandleNewUserInputLetter(char newLetter, int atPosition, ArduinoLetterController alc)
    {
        if (sessionManager != null && SessionsDirector.DelegateControlToStudentActivityController)

                        studentActivityController.HandleNewArduinoLetter (newLetter, atPosition);
                else

                        arduinoLetterController.UpdateDefaultColoursAndSoundsOfLetters (true);
    }
    // Use this for initialization
    void Start()
    {
        global = this;
                sessionParametersOB = GameObject.Find ("SessionParameters");

                screenMode = sessionParametersOB.GetComponent<SessionsDirector> ().IsScreenMode ();

                if (screenMode) {
                        arduinoLetterInterfaceG0.SetActive (false);
                        uniduinoG0.SetActive (false);

                } else { //tangible mode; activate the arduino unity interface and uniduino objects.
                        arduinoLetterInterface = arduinoLetterInterfaceG0.GetComponent<ArduinoUnityInterface> ();
                        arduinoLetterInterfaceG0.SetActive (true);
                        arduinoLetterInterface.Initialize ();
                        uniduinoG0.SetActive (true);
                        uniduinoG0.GetComponent<Uniduino.Arduino> ().Connect ();

                }

                totalLengthOfUserInputWord = numOnscreenLetterSpaces;

                arduinoLetterController = arduinoLetterControllerGO.GetComponent<ArduinoLetterController> ();
                arduinoLetterController.Initialize (0, numOnscreenLetterSpaces - 1, arduinoLetterInterface);
                wordHistoryController = wordHistoryControllerGO.GetComponent<WordHistoryController> ();
                wordHistoryController.Initialize (totalLengthOfUserInputWord);

                checkedWordImageController = checkedWordImageControllerGO.GetComponent<CheckedWordImageController> ();

                foreach (PhonoBlocksController c in Resources.FindObjectsOfTypeAll<PhonoBlocksController>())
                        c.UserInputRouter = global;

                hintButtonGO.SetActive (false);

                if (sessionParametersOB != null) {

                        sessionManager = sessionParametersOB.GetComponent<SessionsDirector> ();
                        if (SessionsDirector.DelegateControlToStudentActivityController) {

                                studentActivityControllerGO = sessionManager.studentActivityControllerOB;
                                studentActivityController = studentActivityControllerGO.GetComponent<StudentActivityController> ();

                                studentActivityController.Initialize (hintButtonGO, arduinoLetterController);
                                userStarControllerGO.SetActive (true);
                                userStarController = userStarControllerGO.GetComponent<UserStarGridController> ();
                                userStarController.Initialize ();

                        } else {
                                replayInstructionsButton.SetActive (false);
                                userStarControllerGO.SetActive (false);
                        }

                }
    }
    public void Initialize(GameObject hintButton, ArduinoLetterController arduinoLetterController)
    {
        this.arduinoLetterController = arduinoLetterController;
                usersMostRecentChanges = new char[UserInputRouter.numOnscreenLetterSpaces];

                lockedPositionHandler = gameObject.GetComponent<LockedPositionHandler> ();

                hintController = gameObject.GetComponent<HintController> ();
                hintController.Initialize (hintButton);

                SetUpNextProblem ();

                excellent = InstructionsAudio.instance.excellent;
                incorrectSoundEffect = InstructionsAudio.instance.incorrectSoundEffect;
                notQuiteIt = InstructionsAudio.instance.notQuiteIt;
                offerHint = InstructionsAudio.instance.offerHint;
                youDidIt = InstructionsAudio.instance.youDidIt;
                correctSoundEffect = InstructionsAudio.instance.correctSoundEffect;
                removeAllLetters = InstructionsAudio.instance.removeAllLetters;

                triumphantSoundForSessionDone = InstructionsAudio.instance.allDoneSession;
    }