Difference between revisions of "Talk:Starrynte/Melee Evaluator Source"

From Robowiki
Jump to navigation Jump to search
(nice, why the default constructor throwing an exception?)
 
m (reformat code)
Line 2: Line 2:
 
<pre>
 
<pre>
 
public MeleeEvaluate(){
 
public MeleeEvaluate(){
throw new RuntimeException("YOU MUST SPECIFY EXACTLY ONE (1) ADVANCED ROBOT AS A PARAMETER!");
+
throw new RuntimeException("YOU MUST SPECIFY EXACTLY ONE (1) ADVANCED ROBOT AS A PARAMETER!");
}
+
}
 
</pre>
 
</pre>
  
 
You could simply remove the default constructor, since you have a constructor with parameters Java won't create a default constructor for the class. So a call like <code>new MelleEvaluate()</code> would give compilation error instead of having to wait for a runtime error to find out. --[[User:Zyx|zyx]] 06:35, 14 September 2009 (UTC)
 
You could simply remove the default constructor, since you have a constructor with parameters Java won't create a default constructor for the class. So a call like <code>new MelleEvaluate()</code> would give compilation error instead of having to wait for a runtime error to find out. --[[User:Zyx|zyx]] 06:35, 14 September 2009 (UTC)

Revision as of 08:36, 14 September 2009

Nice work, I haven't used it because I've been kind of busy lately, but I will try it when I start working on melee again. I was thinking about writing some melee evaluation myself anyway, I already do with 1v1. One question though, why do you have

public MeleeEvaluate(){
	throw new RuntimeException("YOU MUST SPECIFY EXACTLY ONE (1) ADVANCED ROBOT AS A PARAMETER!");		
}

You could simply remove the default constructor, since you have a constructor with parameters Java won't create a default constructor for the class. So a call like new MelleEvaluate() would give compilation error instead of having to wait for a runtime error to find out. --zyx 06:35, 14 September 2009 (UTC)