Exemplo n.º 1
0
    public List <int> Generate(int amount = 10, bool debug = false)
    {
        Tape tape   = new Tape();
        Tape result = new Tape();

        for (int i = 0; i < amount; i++)
        {
            tape.Add(Random.Range(0, 2));
        }
        for (int i = 0; i < amount; i++)
        {
            result.Add(Process(tape, i));
        }
        List <int> res = PostProcess(result);

        if (debug)
        {
            Debug.Log(
                tapeString(tape) + " => \n" +
                tapeString(result) + " => \n" +
                tapeString(res)
                );
        }
        return(res);
    }
Exemplo n.º 2
0
 private int GetValue(int key)
 {
     if (Tape.ContainsKey(key))
     {
         return(Tape[key]);
     }
     Tape.Add(key, 0);
     return(0);
 }
Exemplo n.º 3
0
    public Tape Slice(int start, int end)
    {
        Tape slice = new Tape();

        for (int i = start; i < end; i++)
        {
            slice.Add(this.CircularGet(i));
        }
        return(slice);
    }
Exemplo n.º 4
0
 public void AddTapeData(char symbol, bool toEnd)
 {
     if (toEnd)
     {
         Tape.Add(symbol);
     }
     else
     {
         Tape.Insert(0, symbol);
     }
 }