<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title><![CDATA[Java Programming Forums - The Java Community - Algorithms & Recursion]]></title>
		<link>http://www.javaprogrammingforums.com/</link>
		<description />
		<language>en</language>
		<lastBuildDate>Wed, 19 Jun 2013 06:29:17 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.javaprogrammingforums.com/images/misc/rss.png</url>
			<title><![CDATA[Java Programming Forums - The Java Community - Algorithms & Recursion]]></title>
			<link>http://www.javaprogrammingforums.com/</link>
		</image>
		<item>
			<title>Killer Moves Heuristic for Alpha-Beta (Connect 4), need some technical help</title>
			<link>http://www.javaprogrammingforums.com/algorithms-recursion/29792-killer-moves-heuristic-alpha-beta-connect-4-need-some-technical-help.html</link>
			<pubDate>Sat, 01 Jun 2013 15:03:18 GMT</pubDate>
			<description>Hi all. first of all let me apologize in advance for this rather noob question and if this is not the right sub-forum please let me know and transfer...</description>
			<content:encoded><![CDATA[<div>Hi all. first of all let me apologize in advance for this rather noob question and if this is not the right sub-forum please let me know and transfer the post. <br />
I am a java beginner/intermediate,but very facinated with AI programming and programming in general. I am developing my own connect 4 android app, and i am using a standart MiniMax algorithm with Alpha-Beta for the search. But the problem is that in depth &gt;9 the search just takes too much time. so,searching for a easy to implement anhancement for my Alpha-Beta i came across the &quot;Killer Move&quot; Heuristic which i pretty much got the idea of it. But i need some help to implement it in my code. <br />
<br />
This is my MiniMax function, the &quot;Best&quot; Object holds a move(int) and also a score for that move (also an int). <br />
And i know that i need to catch the move that causes a cut-off (when alpha&gt;=beta) and use it as a killer move,but i just can't figure out how to do it exactly. do i need to make it for each ply?  where exactly should i initialize the killerMove variable inside this function?  <br />
please Don't think i am lazy, i DID searched the net and couldn't find code examples for this,only theoretical background. and i really would like to implement it in my code and learn another thing and increase my experience.Even if i can somehow manage to do it by myself, it is important to me that i am doing it right. <br />
 Any help would be appreciated!   below is my Minimax function<br />
<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code java:</div>
                <hr /><code class="bbcode_code"><div class="java" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">	<span style="color: #7F0055; font-weight: bold;">public</span> Best chooseMove<span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">boolean</span> side,<span style="color: #000066; font-weight: bold;">int</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>board,<span style="color: #000066; font-weight: bold;">int</span> alpha,<span style="color: #000066; font-weight: bold;">int</span> beta,<span style="color: #000066; font-weight: bold;">int</span> depth,<span style="color: #000066; font-weight: bold;">int</span> maxDepth<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
		Best myBest <span style="color: #000000;">=</span> <span style="color: #7F0055; font-weight: bold;">new</span> Best<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
		Best reply<span style="color: #000000;">;</span>
		<span style="color: #000066; font-weight: bold;">int</span> num<span style="color: #000000;">;</span>
		<span style="color: #7F0055; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>Board.<span style="color: #000000;">checkGameOver</span><span style="color: #000000;">&#40;</span>board<span style="color: #000000;">&#41;</span><span style="color: #000000;">||</span>depth<span style="color: #000000;">==</span>maxDepth<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			myBest.<span style="color: #000000;">setScore</span><span style="color: #000000;">&#40;</span>returnPositionScore<span style="color: #000000;">&#40;</span>board<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
			<span style="color: #7F0055; font-weight: bold;">return</span> myBest<span style="color: #000000;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #7F0055; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>side<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			myBest.<span style="color: #000000;">setScore</span><span style="color: #000000;">&#40;</span>alpha<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
			num <span style="color: #000000;">=</span> numberOfEngine<span style="color: #000000;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #7F0055; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
			myBest.<span style="color: #000000;">setScore</span><span style="color: #000000;">&#40;</span>beta<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
			num <span style="color: #000000;">=</span> numberOfOpponent<span style="color: #000000;">;</span>
		<span style="color: #000000;">&#125;</span>
        ArrayList<span style="color: #000000;">&lt;</span>Integer<span style="color: #000000;">&gt;</span> availableMoves <span style="color: #000000;">=</span> <span style="color: #7F0055; font-weight: bold;">new</span> ArrayList<span style="color: #000000;">&lt;</span>Integer<span style="color: #000000;">&gt;</span><span style="color: #000000;">&#40;</span>searchAvailableMoves<span style="color: #000000;">&#40;</span>board<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
&nbsp;
        <span style="color: #7F0055; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Integer</span></a> move<span style="color: #000000;">:</span>availableMoves<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
        	board<span style="color: #000000;">&#91;</span>move.<span style="color: #000000;">intValue</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> num<span style="color: #000000;">;</span>
        	reply <span style="color: #000000;">=</span> chooseMove<span style="color: #000000;">&#40;</span><span style="color: #000000;">!</span>side,board,alpha,beta,depth<span style="color: #000000;">+</span><span style="color: #cc66cc;">1</span>,maxDepth<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
        	board<span style="color: #000000;">&#91;</span>move.<span style="color: #000000;">intValue</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #000000;">;</span>
			<span style="color: #7F0055; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>side<span style="color: #000000;">&amp;&amp;</span>reply.<span style="color: #000000;">getScore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&gt;</span>myBest.<span style="color: #000000;">getScore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
				myBest.<span style="color: #000000;">setMove</span><span style="color: #000000;">&#40;</span>move<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
				myBest.<span style="color: #000000;">setScore</span><span style="color: #000000;">&#40;</span>reply.<span style="color: #000000;">getScore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
				alpha <span style="color: #000000;">=</span> reply.<span style="color: #000000;">getScore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #7F0055; font-weight: bold;">else</span> <span style="color: #7F0055; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">!</span>side<span style="color: #000000;">&amp;&amp;</span>reply.<span style="color: #000000;">getScore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&lt;</span>myBest.<span style="color: #000000;">getScore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
				myBest.<span style="color: #000000;">setMove</span><span style="color: #000000;">&#40;</span>move<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
				myBest.<span style="color: #000000;">setScore</span><span style="color: #000000;">&#40;</span>reply.<span style="color: #000000;">getScore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
				beta <span style="color: #000000;">=</span> reply.<span style="color: #000000;">getScore</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #7F0055; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>alpha<span style="color: #000000;">&gt;=</span>beta<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
				<span style="color: #7F0055; font-weight: bold;">return</span> myBest<span style="color: #000000;">;</span>
			<span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #7F0055; font-weight: bold;">return</span> myBest<span style="color: #000000;">;</span>
	<span style="color: #000000;">&#125;</span></pre></div></code><hr />
</div> </div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/algorithms-recursion/"><![CDATA[Algorithms & Recursion]]></category>
			<dc:creator>patishi</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/algorithms-recursion/29792-killer-moves-heuristic-alpha-beta-connect-4-need-some-technical-help.html</guid>
		</item>
		<item>
			<title>make own OCR</title>
			<link>http://www.javaprogrammingforums.com/algorithms-recursion/29765-make-own-ocr.html</link>
			<pubDate>Fri, 31 May 2013 05:09:02 GMT</pubDate>
			<description>Hi friends, 
 
I am Suhail and I got college project to make on OCR so please any one can help me to know how to write code for OCR in java . 
 
I...</description>
			<content:encoded><![CDATA[<div>Hi friends,<br />
<br />
I am Suhail and I got college project to make on OCR so please any one can help me to know how to write code for OCR in java .<br />
<br />
I want to know the logic to recognize  character from image....</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/algorithms-recursion/"><![CDATA[Algorithms & Recursion]]></category>
			<dc:creator>Suhail Tamboli</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/algorithms-recursion/29765-make-own-ocr.html</guid>
		</item>
		<item>
			<title>Waveform Generator?</title>
			<link>http://www.javaprogrammingforums.com/algorithms-recursion/29671-waveform-generator.html</link>
			<pubDate>Sun, 26 May 2013 06:30:46 GMT</pubDate>
			<description><![CDATA[Hey guys. So, I am wondering.. I need to implement this interface for some of the common waveforms such as sine: 
<div class="bbcode_container"> 
   ...]]></description>
			<content:encoded><![CDATA[<div>Hey guys. So, I am wondering.. I need to implement this interface for some of the common waveforms such as sine:<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">public interface SignalFunction
{
	public double f(int freq, int time);
}</pre></div></code><hr />
</div> And.. im not exactly sure how... I mean for sine, would it simply be this:<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">public double f(int freq, int time)
{
        return Math.sin(time);
}</pre></div></code><hr />
</div> ?<br />
As for sawtooth, triangle and square, im not sure. If anyone can help me implement these, I would really appreciate it. Thanks!<br />
<br />
EDIT:<br />
<br />
okay... so... I am currently working on making a triangle wave. I have this:<br />
<div class="bbcode_container">
                <div class="bbcode_description">Code :</div>
                <hr /><code class="bbcode_code"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Math.abs((((2 * t) / Math.PI - 1) % 4) - 2) - 1</pre></div></code><hr />
</div> It almost works... but its not QUITE a triangle.... what am I doing wrong?</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/algorithms-recursion/"><![CDATA[Algorithms & Recursion]]></category>
			<dc:creator>sci4me</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/algorithms-recursion/29671-waveform-generator.html</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] A linearithmic (at most) complexity algorithm to generate Pythagorean triples]]></title>
			<link>http://www.javaprogrammingforums.com/algorithms-recursion/29661-linearithmic-most-complexity-algorithm-generate-pythagorean-triples.html</link>
			<pubDate>Sat, 25 May 2013 18:26:02 GMT</pubDate>
			<description><![CDATA[I've been working on ProjectEuler's Problem 75 (http://projecteuler.net/problem=75) for about 4 days already, and it completely burns my brain. It's...]]></description>
			<content:encoded><![CDATA[<div>I've been working on ProjectEuler's <a href="http://projecteuler.net/problem=75" target="_blank">Problem 75</a> for about 4 days already, and it completely burns my brain. It's easy to generate Pythagorean triples with Euler's or Dickson's methods, but they're all of quadratic complexity, not something you want to use when aiming for ~million triples. I just can't figure any better method. So, can anybody suggest me an algorithm of at most linearithmic complexity to generate all the Pythagorean triples?</div>

]]></content:encoded>
			<category domain="http://www.javaprogrammingforums.com/algorithms-recursion/"><![CDATA[Algorithms & Recursion]]></category>
			<dc:creator>angstrem</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/algorithms-recursion/29661-linearithmic-most-complexity-algorithm-generate-pythagorean-triples.html</guid>
		</item>
	</channel>
</rss>
