Exemple #1
0
 // Returns true if adding the node was successful
 // Returns false if the Note in the NoteNode being added is already connected
 public bool AddConnection(NoteNode note, double weight)
 {
     if (!IsConnected(note.GetNote()))
     {
         connections[NoteUtil.NoteHash(note.GetNote())] = new Edge(note, weight);
         return(true);
     }
     return(false);
 }
Exemple #2
0
        public NoteGraph()
        {
            double initial_weight = 1.00 / 22.00;

            for (int i = 0; i < NoteUtil.NOTE_COUNT; ++i)
            {
                nodes[i] = new NoteNode(NoteUtil.GetNoteAtIndex(i));
            }

            for (int i = 0; i < NoteUtil.NOTE_COUNT; ++i)
            {
                for (int k = 0; k < NoteUtil.NOTE_COUNT; ++k)
                {
                    nodes[i].AddConnection(nodes[k], initial_weight);
                }
            }
        }
Exemple #3
0
        public NoteGraph()
        {
            double initial_weight = 1.00 / 22.00;

            for (int i = 0; i < NoteUtil.NOTE_COUNT; ++i)
            {
                nodes[i] = new NoteNode(NoteUtil.GetNoteAtIndex(i));
            }

            for (int i = 0; i < NoteUtil.NOTE_COUNT; ++i)
            {
                for (int k = 0; k < NoteUtil.NOTE_COUNT; ++k)
                {
                    nodes[i].AddConnection(nodes[k], initial_weight);
                }
            }
        }
Exemple #4
0
        public List <NoteNode> GetNoteSequenceAsList(Random gen)
        {
            List <NoteNode> sequence = new List <NoteNode>();
            NoteNode        current  = nodes[gen.Next(NoteUtil.NOTE_COUNT)];

            // eliminate initial behavior
            for (int i = 0; i < 50; ++i)
            {
                current = current.GetNextNode(gen);
            }

            for (int i = 0; i < 8; ++i)
            {
                sequence.Add(current);
                current = current.GetNextNode(gen);
            }

            return(sequence);
        }
Exemple #5
0
 public Edge(NoteNode n, double w)
 {
     this.n      = n;
     this.weight = w;
 }
Exemple #6
0
 public Edge(NoteNode n, double w)
 {
     this.n = n;
     this.weight = w;
 }
Exemple #7
0
 // Returns true if adding the node was successful
 // Returns false if the Note in the NoteNode being added is already connected
 public bool AddConnection(NoteNode note, double weight)
 {
     if (!IsConnected(note.GetNote()))
     {
         connections[NoteUtil.NoteHash(note.GetNote())] = new Edge(note,weight);
         return true;
     }
     return false;
 }