Tuesday, March 24, 2015

Cops 4 Kidz Part 5: The Frustration

I continued on my quest to try and program an algorithm that would the donuts compare sizes and which platform they were on.  There's not a whole lot more to say other than how frustrating it is to come up with an advanced algorithm for a language I just started learning.  Even some of the basic syntax for C# vexes me, as it seems to want me to jump through hoop after hoop.  In a previous language i used to write scripts for, you could alter and object's properties by just naming the object then putting the property you wanted to edit next to it.  For example: "objectName.x" or objectName.speed", it was fairly simple.  But with Unity, you have set up the object as a GameObject, then use GetComponent to actually call the script you need, then use the script to finally access the variable.  It's just been and incredibly frustrating few weeks.



1 comment:

  1. Here Noah, heres a sampling of Towers of Hanoi, I'll include the links as well

    public class TowersOfHanoi {

    public void solve(int n, String start, String auxiliary, String end) {
    if (n == 1) {
    System.out.println(start + " -> " + end);
    } else {
    solve(n - 1, start, end, auxiliary);
    System.out.println(start + " -> " + end);
    solve(n - 1, auxiliary, start, end);
    }
    }

    public static void main(String[] args) {
    TowersOfHanoi towersOfHanoi = new TowersOfHanoi();
    System.out.print("Enter number of discs: ");
    Scanner scanner = new Scanner(System.in);
    int discs = scanner.nextInt();
    towersOfHanoi.solve(discs, "A", "B", "C");
    }
    }

    Source: http://www.javawithus.com/programs/towers-of-hanoi

    ReplyDelete