public Theory NextTheory(bool suspectIs, bool localIs, bool gunIs)
        {
            Theory nextTheory = new Theory();

            if (this.currenteTheory == null)
            {
                this.NextLocalIs(nextTheory);
                this.NextGun(nextTheory);
                this.NextSuspect(nextTheory);
            }
            else
            {
                if (!localIs)
                    this.NextLocalIs(nextTheory);
                else
                    nextTheory.Local = this.currenteTheory.Local;

                if (!gunIs)
                    this.NextGun(nextTheory);
                else
                    nextTheory.Gun = this.currenteTheory.Gun;

                if (!suspectIs)
                    this.NextSuspect(nextTheory);
                else
                    nextTheory.Suspect = this.currenteTheory.Suspect;
            }

            this.currenteTheory = nextTheory;
            return this.currenteTheory;
        }
        public ResponseType Reply(Theory theory)
        {
            if (!string.Equals(response.Suspect, theory.Suspect))
                return ResponseType.Suspect;
            else if (!string.Equals(response.Local, theory.Local))
                return ResponseType.Local;
            else if (!string.Equals(response.Gun, theory.Gun))
                return ResponseType.Gun;

            return ResponseType.Right;
        }
 private void NextLocalIs(Theory nextTheory)
 {
     if (this.indexLocal < this.caseForMountTheory.Locals.Count())
     {
         nextTheory.Local = this.caseForMountTheory.Locals.ToList()[this.indexLocal];
         this.indexLocal++;
     }
     else
     {
         nextTheory.Local = this.caseForMountTheory.Locals.ToList()[0];
         this.indexLocal = 0;
     }
 }
 private void NextGun(Theory nextTheory)
 {
     if (this.indexGun < this.caseForMountTheory.Guns.Count())
     {
         nextTheory.Gun = this.caseForMountTheory.Guns.ToList()[this.indexGun];
         this.indexGun++;
     }
     else
     {
         nextTheory.Gun = this.caseForMountTheory.Locals.ToList()[0];
         this.indexGun = 0;
     }
 }
        private bool WhoGun(ResponseType response, ResponseType responseRigth, TheoryService theoryService, Witness witness, Theory theory)
        {
            if (response == responseRigth)
            {
                Theory newTheory = theoryService.NextTheory(true, true, false);

                ResponseType newResponse = witness.Reply(newTheory);

                if (WhoGun(newResponse, response, theoryService, witness, theory))
                    theory.Gun = newTheory.Gun;

                return false;
            }

            return true;
        }
        public bool WhoSuspect(ResponseType response, ResponseType responseRigth, TheoryService theoryService, Witness witness, Theory theory)
        {
            if (response == responseRigth)
            {
                Theory newTheory = theoryService.NextTheory(false, true, true);

                ResponseType newResponse = witness.Reply(newTheory);

                if (WhoSuspect(newResponse, response, theoryService, witness, theory))
                    theory.Suspect = newTheory.Suspect;

                return false;
            }

            return true;
        }
 private void NextSuspect(Theory nextTheory)
 {
     if (this.indexSuspec < this.caseForMountTheory.Suspects.Count())
     {
         nextTheory.Suspect = this.caseForMountTheory.Suspects.ToList()[this.indexSuspec];
         this.indexSuspec++;
     }
     else
     {
         nextTheory.Suspect = this.caseForMountTheory.Suspects.ToList()[0];
         this.indexSuspec = 0;
     }
 }