Page 1 of 1

Stack Report feature

PostPosted: 09 Oct 2009, 18:13
by mtgrares
I believe I know how the stack report feature works but feel free to correct me if I'm wrong. The most common problem is when MTG Forge says the "Computer is thinking" which really means that the AI has crashed because it was trying to play some card that had an error with it. The idea is to use the new stack reporting feature when the AI has crashed and says the "Computer is thinking".

I'll try to briefly explain what the stack reporting feature shows.

Code: Select all
String index out of range: 2

Detailed error trace:
java.lang.StringIndexOutOfBoundsException: String index out of range: 2
   at ManaPool.oraclize(ManaPool.java:98)
   at ManaPool.subtractMana(ManaPool.java:212)
Unexpected situations in computer programming causes errors and errors are called exceptions in Java. The easiest way to check for errors is to "throw an Exception" if an abnormal action occurs. There are many different types of exceptions and the specific exception in this case is called StringIndexOutOfBoundsException.

The "stack trace" is a listing of all of the objects and methods that were called. ManaPool.subtractMana() means that the object is called ManaPool and the method is subtractMana() - think subject verb, most object names are nouns and methods are verbs. ManaPoo.subtractMana() on like 212 in the file ManaPool.java called ManaPool.oraclize() which caused an error at line 98 in the file ManaPool.java.

I hope that helps.

p.s. Instead of saying the "Computer is thinking" it really should say "An error has occurred". In the beginning I thought the AI might actually take a few seconds to think so that is why I wrote the "Computer is thinking".