Beispiel #1
0
 /// <summary>
 /// Use this constructer to tell the codelet which analogy to examine.
 /// Otherwise, it picks randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public SuggestSameLengthAnalogyCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, Group sourceGroup)
     : base("Suggest Same Length Analogy", urgency, parent, coderack, workspace, slipnet)
 {
     this.sourceGroup = sourceGroup;
 }
Beispiel #2
0
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public SuggestGroupFromExpectationCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, ExpectedGroup eg)
     : base("Suggest Group From Expectation", urgency, parent, coderack, workspace, slipnet)
 {
     this.eg = eg;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which measure to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public ExamineLinkedPairsCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, MeasureLink link)
     : base("Examine Linked Pairs", urgency, parent, coderack, workspace, slipnet)
 {
     this.link = link;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public GroupReasonMusicalForcesClosureCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet,
                                               Group group)
     : base("Group Reason Musical Forces Closure", urgency, parent, coderack, workspace, slipnet)
 {
     this.group = group;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which measure to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public LookForTranspositionRelationshipCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet,
                                                RelationshipMelodyContour cr)
     : base("Look for Transposition Relationship", urgency, parent, coderack, workspace, slipnet)
 {
     this.cr = cr;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which link to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public GenerateExpectedGroupCopyCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, Group group)
     : base("Generate Expected Group Copy", urgency, parent, coderack, workspace, slipnet)
 {
     this.group = group;
 }
Beispiel #7
0
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public SuggestLinkFromExpectationCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, ExpectedMeasureLink elink)
     : base("Suggest Link From Expectation", urgency, parent, coderack, workspace, slipnet)
 {
     this.elink = elink;
 }
Beispiel #8
0
 public virtual void PostCodelets(Coderack coderack, Workspace workspace, Slipnet slipnet)
 {
 }
Beispiel #9
0
        private static void Init()
        {
            pausing = true;
            TextWriter tw;

            if (GUIenabled)
            {
                // Get and update the program run number.
                try {
                    TextReader tr     = new StreamReader(@"C:\RhythmcatScreenshots\config.txt");
                    string     numStr = tr.ReadToEnd().Trim();
                    tr.Close();
                    programRunNum = int.Parse(numStr) + 1;
                } catch {
                    programRunNum = 1;
                }
                tw = new StreamWriter(@"C:\RhythmcatScreenshots\config.txt", false);
                tw.WriteLine(programRunNum);
                tw.Close();
            }

            workspace = new Workspace(programRunNum, GUIenabled, curMelodyIndex);

            coderack = new Coderack(workspace);
            slipnet  = new Slipnet(coderack, workspace);

            workspace.Coderack = coderack;
            workspace.Slipnet  = slipnet;
            coderack.Slipnet   = slipnet;           // todo must be in this order to get coderack and slipnet linked to each other.

            if (GUIenabled)
            {
                workspace.CreateTheForms();
            }

            // Reset the big objects.
            workspace.Reset();
            coderack.Reset();
            slipnet.Reset();

            if (GUIenabled)
            {
                workspace.frmWorkspace.setProgramSpeedEvent += new EventHandler <WorkspaceForm.SetProgramSpeedEventArgs>(frmWorkspace_setProgamSpeedEvent);
                workspace.frmWorkspace.setDetailLevelEvent  += new EventHandler <WorkspaceForm.SetDetailLevelEventArgs>(frmWorkspace_setDetailLevelEvent);
                workspace.frmWorkspace.restartEvent         += new EventHandler <WorkspaceForm.RestartEventArgs>(frmWorkspace_restartEvent);
                workspace.frmWorkspace.pauseEvent           += new EventHandler <EventArgs>(frmWorkspace_pauseEvent);
                workspace.Close += new EventHandler <EventArgs>(workspace_Close);
            }

            List <Assembly> assemblies = new List <Assembly>();             // the list of assemblies containing codelets.

            assemblies.Add(Assembly.GetExecutingAssembly());                // Adds the musicat assembly.

            //assemblies.Add(Assembly.GetAssembly(typeof(MeasureLinkerCodelet)));	// Add the Codelets assembly.

            // Prepopulate the coderack with the codelets found in the source code tagged with the CodeletAttribute.
            coderack.Assemblies = assemblies;
            coderack.Populate();

            if (GUIenabled)
            {
                // Write a file containing the list of active codelets for this run.
                tw = new StreamWriter(string.Format(@"C:\RhythmcatScreenshots\codelets-run-{0}.txt", programRunNum), false);
                foreach (string name in coderack.GetActiveCodeletNames())
                {
                    tw.WriteLine(name);
                }
                tw.Close();
            }

            // Setup the slipnet.
            slipnet.Initialize();

            if (GUIenabled)
            {
                Thread.Sleep(100);

                lock (restartLock) {
                    if (!restarting)
                    {
                        workspace.Draw(coderack);
                    }
                }
            }
        }
Beispiel #10
0
 public StrengthenExpectationCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet)
     : base("Strengthen Expectation", urgency, parent, coderack, workspace, slipnet)
 {
 }
Beispiel #11
0
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notesStrengthenExpectationCodeletparam>
 public StrengthenExpectationCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet,
                                     ExpectedGroup group)
     : base("Strengthen Expectation", urgency, parent, coderack, workspace, slipnet)
 {
     this.group = group;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public GroupReasonHierarchyEndCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet,
                                       Group group)
     : base("Group Reason Hierarchy End", urgency, parent, coderack, workspace, slipnet)
 {
     this.group = group;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which measure to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public OldMeasureLinkBreakerCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, Analogy analogy)
     : base("Old Measure Link Breaker", urgency, parent, coderack, workspace, slipnet)
 {
     this.analogy = analogy;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which measure to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public OldMeasureLinkBreakerCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, MeasureLink link)
     : base("Old Measure Link Breaker", urgency, parent, coderack, workspace, slipnet)
 {
     this.link = link;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which analogy to examine.
 /// Otherwise, it picks randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public SuggestParallelAnalogyCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, Analogy sourceAnalogy)
     : base("Suggest Parallel Analogy", urgency, parent, coderack, workspace, slipnet)
 {
     this.sourceAnalogy = sourceAnalogy;
 }
Beispiel #16
0
 public LookForAntecedentConsequentRelationshipCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet)
     : base("Look for Antecedent-Consequent Relationship", urgency, parent, coderack, workspace, slipnet)
 {
 }
Beispiel #17
0
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks one randoml.y
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public AddRelationshipsToAnalogyCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet,
                                         Analogy analogy)
     : base("Add Relationships To Analogy", urgency, parent, coderack, workspace, slipnet)
 {
     this.analogy = analogy;
 }
Beispiel #18
0
 /// <summary>
 /// Use this constructer to tell the codelet which measure to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public LookForAntecedentConsequentRelationshipCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet,
                                                       GroupElement ge1, GroupElement ge2)
     : base("Look for Antecedent-Consequent Relationship", urgency, parent, coderack, workspace, slipnet)
 {
     this.ge1 = ge1;
     this.ge2 = ge2;
 }
Beispiel #19
0
 public SuggestLinkFromExpectationCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet)
     : base("Suggest Link From Expectation", urgency, parent, coderack, workspace, slipnet)
 {
 }
Beispiel #20
0
 public GroupReasonEndPitchCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet)
     : base("Group Reason End Pitch", urgency, parent, coderack, workspace, slipnet)
 {
 }
Beispiel #21
0
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public GroupPenaltyHierarchyCrossingCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet,
                                             Group group)
     : base("Group Penalty Hierarchy Crossing", urgency, parent, coderack, workspace, slipnet)
 {
     this.group = group;
 }
 /// <summary>
 /// Use this constructer to tell the codelet which analogy to examine.
 /// Otherwise, it picks randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public StoreStrongAnalogy(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, Analogy analogy)
     : base("Store Strong Analogy", urgency, parent, coderack, workspace, slipnet)
 {
     this.analogy = analogy;
 }
 public LookForTranspositionRelationshipCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet)
     : base("Look for Transposition Relationship", urgency, parent, coderack, workspace, slipnet)
 {
 }
Beispiel #24
0
 /// <summary>
 /// Use this constructer to tell the codelet which analogy to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public FormLabelFromAnalogy(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet, Analogy a)
     : base("Form Label Assigner", urgency, parent, coderack, workspace, slipnet)
 {
     this.a = a;
 }
Beispiel #25
0
 /// <summary>
 /// Use this constructer to tell the codelet which group to examine.
 /// Otherwise, it picks one randomly.
 /// </summary>
 /// <param name="urgency"></param>
 /// <param name="parent"></param>
 /// <param name="coderack"></param>
 /// <param name="workspace"></param>
 /// <param name="slipnet"></param>
 /// <param name="notes"></param>
 public GroupReasonRhythmGapCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet,
                                    Group group)
     : base("Group Reason Rhythmic Gap", urgency, parent, coderack, workspace, slipnet)
 {
     this.group = group;
 }
Beispiel #26
0
 public SuggestSameLengthAnalogyCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet)
     : base("Suggest Same Length Analogy", urgency, parent, coderack, workspace, slipnet)
 {
 }
Beispiel #27
0
 public MeasureLinkerCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet)
     : base("Measure Linker", urgency, parent, coderack, workspace, slipnet)
 {
 }
 public ExamineLinkedPairsCodelet(int urgency, Codelet parent, Coderack coderack, Workspace workspace, Slipnet slipnet)
     : base("Examine Linked Pairs", urgency, parent, coderack, workspace, slipnet)
 {
 }