Saturday, 4 April 2015

The End is Where We Begin

-D04, M04, Y15-

Cheesy title? Cheesy title.
Hello there, glad you could make it. Essentially, the course for computer science related to this blog has come to an end. Will this be the final post? I doubt it. Anywho, let us get started.

Having received marks for the second term test, it is clear that my primary problem is failing to take into consideration all cases--outcome options available--in my functions. Minor problems, such as forgetting the structure of binary trees for a specific case and forgetting to reset the value of a node in a linked list when the function or method is looking at the front are quickly resolved. Dealing with multiple cases will likely be a stronger problem resolved simply through practice.

Concerning the final assignment and the three versions of minimax, I discovered a solution to memoization by ignoring my intuition. My intuition was telling me to add results to the dictionary only at the very end of each tree branch while somehow remembering the internal nodes that brought the recursive function to that outcome. Because that intuition was failing to be effective (I may have said this before, but my memoize 'optimization' was actually running slower than my original minimax strategy), I trusted in the fact that recursion can come up with a result "earlier on"--that is, I could add results to the dictionary while the function was still on an internal node. I do not know if that makes any sense, but it seems to work. As for pruning...I believe I ruined that optimization. I have no intuition as to how it should exactly work. I attempted to have my function remember the best outcome for the original player as well as the best outcome for the enemy player as well as deal with each state of the game differently depending on whether it was the original player's turn or not, but it did not work well. Trying to keep track of the best outcome for each player and compare them properly in a recursive function with many different moves is painful. I hope it becomes more transparent and easy-to-follow as I progress in this field. Then again, a senior engineering friend of mine says recursion never gets any clearer, so there's that.

And as for what we were doing in class these past two weeks: it was--for me--review of Big Oh notation and determining the operating complexity of different functions. If that type of stuff catches your attention, check out my archived posts from mid to late 2014. On top of that: recursion operates on the logarithmic order of complexity. This makes sense, since the height of a full binary tree with n nodes is approximately log(n) with a base of 2. Worst-case scenario: At each level of the tree, the recursive code would enact its function(s) and continue to the next level of the tree until the entire tree is traversed.

Overall, this course was very helpful in introducing the structures of data and the ways in which data can be manipulated. Efficient coding through inheritance of structure and operation from parent classes to be used by subclasses for specific implementations, the power of recursion to deal with convoluted data structures like binary trees, and the use of linked lists to reduce run-time complexity in searching over data are all foundational necessities that both reveals the scope of computer science and offers the opportunity to narrow one's interest down to more specialized fields...like video game design.

Thank you for reading.

No comments:

Post a Comment