<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vlixter.com &#187; Tutorials</title>
	<atom:link href="http://vlixter.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://vlixter.com</link>
	<description>Programming , Tech, and stuff</description>
	<lastBuildDate>Mon, 30 Aug 2010 14:50:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Project Euler :: Problem 2 :: Haskell</title>
		<link>http://vlixter.com/2010/01/02/project-euler-problem-2-haskell/</link>
		<comments>http://vlixter.com/2010/01/02/project-euler-problem-2-haskell/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 14:35:11 +0000</pubDate>
		<dc:creator>radicality</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Project Euler]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[project-euler]]></category>

		<guid isPermaLink="false">http://vlixter.com/?p=144</guid>
		<description><![CDATA[This is the second tutorial on solving Project Euler problems using Haskell. Hope you will enjoy! Problem Description: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second tutorial on solving <a href="http://projecteuler.net/" target="_blank">Project Euler</a> problems using Haskell. Hope you will enjoy!</p>
<p><strong>Problem Description:</strong></p>
<blockquote><p>Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:</p>
<p>1, 2, 3, 5, 8, 13, 21, 34, 55, 89, &#8230;</p>
<p>Find the sum of all the even-valued terms in the sequence which do not exceed four million.</p></blockquote>
<p>Again, create a new text file and call it euler2.hs</p>
<p>First, we are required to make a function that computes the numbers of the Fibonnacci sequence. From the definition fib(x) = fib(x-1) + fib(x-2), we can easily code this in Haskell.</p>
<p>Here is how it would look:</p>
<pre class="brush:ruby">fib :: Int -&gt; Int
fib 1 = 1
fib 2 = 1
fib x = fib(x-1) + fib(x-2)
</pre>
<p>Now on to test this function. Open up ghci, load the file, and type in &#8220;fib 30&#8243;, which asks for the 30th Fibonacci numbers.  Actually, this will be quite slow, here are my results:</p>
<pre class="brush:ruby">*Euler1&gt; fib 30
832040
(2.46 secs, 172153128 bytes)
</pre>
<p>2.46 seconds to get the 30th number ? Way too slow. What is happening here, is that the computer has to do a lot of counting.</p>
<p>fib(30) = fib(29) + fib(28)</p>
<p>= [fib(28) + fib(27)] + [fib(27) + fib(26) ]</p>
<p>and so on and on, expanding the fib, until the problem is reduced to adding up a whole bunch of 1&#8242;s together, as the first two terms are 1&#8242;s.</p>
<p>So we need a solution, where we don&#8217;t need to recompute fib as many times, so you could call it a form of &#8220;caching&#8221;.</p>
<p>Here is my proposed solution:</p>
<pre class="brush:ruby">fib :: Int -&gt; Int
fib n = table !! n
 where
   table = 0 : 1 : zipWith (+) table (tail table)
</pre>
<p>Whoa, what&#8217;s happening here ? We are creating a &#8220;table&#8221; of the Fibonacci numbers, and then simply calling the &#8220;!!&#8221; (value at index) function to get our desired number.</p>
<p>We define a table as a list, with first element 0, and second element 1, and with the rest of the list being computed recursively using &#8220;zipWith (+)&#8221;.</p>
<p>&#8220;zipWith&#8221; is a function that takes another function, such as the plus function (+), and two lists, and it &#8220;zips&#8221; them together using that operator.</p>
<p>For example, zipWith (+) [1,2,3] [1,1,1] will return the list [2,3,4].</p>
<p>Understanding the above revised fib function is best done by simply expanding the recursive bit. Here it is from my prompt.</p>
<pre class="brush:ruby">*Euler1&gt; zipWith (+) [0,1] [1]
[1]
*Euler1&gt; zipWith (+) [0,1,1] [1,1]
[1,2]
*Euler1&gt; zipWith (+) [0,1,1,2] [1,1,2]
[1,2,3]
*Euler1&gt; zipWith (+) [0,1,1,2,3] [1,1,2,3]
[1,2,3,5]
*Euler1&gt; zipWith (+) [0,1,1,2,3,5] [1,1,2,3,5]
[1,2,3,5,8]
</pre>
<p>So we are seeing how the second parameter of zipWith is our desired sequence. Since Haskell implement lazy evaluation, it will stop computing the list as soon as it reaches &#8220;n&#8221;.</p>
<p>This approach is also much faster than the previous one. See for yourself!</p>
<pre class="brush:ruby">*Euler1&gt; fib 30
832040
(0.00 secs, 528596 bytes)
</pre>
<p>0.00 seconds is quite damn fast, and the solution uses up a lot less memory than the previous one!</p>
<p>Now using our knowledge of list comprehensions from the <a href="http://vlixter.com/2010/01/02/project-euler-problem-1-haskell/" target="_blank">previous tutorial</a>, and the function described above, we can solve problem 2 on Project Euler.</p>
<pre class="brush:ruby">fib n = table !! n
 where
    table = 0 : 1 : zipWith (+) table (tail table)

euler2 = sum[x | x&lt;- takeWhile (&lt;4000000) (map fib [1..]), even(x)]</pre>
<p>Line 5 has a couple new function we aren&#8217;t familiar with, such as takeWhile, map, and even.</p>
<p>&#8220;even&#8221; returns true when its parameter is even, and else it returns false. Hence, &#8220;even(x)&#8221; is one of our conditions for the list comprehension</p>
<p>Now the main part of this is</p>
<pre class="brush:ruby">x &lt;- takeWhile (&lt;4000000) (map fib [1..])
</pre>
<p>Let&#8217;s look at &#8220;map&#8221; first. &#8220;Map&#8221; is a function which takes another function, and a list, and it applies that function to every element of the list.</p>
<p>For example, &#8220;map (+1) [1,2,3]&#8221; will return the list [2,3,4]. Think of this as a kind of a &#8220;foreach&#8221; loop you might know from imperative programming languages such as C,C++, Java, etc.</p>
<p>Now the &#8220;takeWhile&#8221; function. This function takes a predicate p, and a list, and returns a list such that all elements in the list meet the predicate p up to a certain point in the list, when we encounter a member that does not follow the predicate, and hence the list is trimmed.</p>
<p>For example, &#8220;takeWhile &lt;5 [1,4,2,6,3]&#8221; will return [1,4,2] since the number 6 does not follow the predicate, it is NOT less than 5.</p>
<p>So finally, what we are saying, is : &#8220;x comes from infinite list of Fibonacci numbers, but trim this list so that we only have elements less than 4 million&#8221;</p>
<p>At the very end, use the predefined &#8220;sum&#8221; function we know from the previous tutorial, to get the sum of the list.</p>
<p>Here is script executing on my machine, very rapidly thanks to that method of computing fibonacci numbers!</p>
<pre class="brush:ruby">*Euler&gt; euler2
4613732
(0.00 secs, 524700 bytes)
</pre>
<p>Thanks for reading! This is only my second tutorial, so could you please post some comments about improving my style, explanations, etc.</p>
<p>Please come back for more tutorials!</p>
]]></content:encoded>
			<wfw:commentRss>http://vlixter.com/2010/01/02/project-euler-problem-2-haskell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TUTORIAL &#8211; How to hack and cheat the Facebook game Tetris / Blockstar</title>
		<link>http://vlixter.com/2008/04/05/tutorial-how-to-hack-and-cheat-the-facebook-game-tetris-blockstar/</link>
		<comments>http://vlixter.com/2008/04/05/tutorial-how-to-hack-and-cheat-the-facebook-game-tetris-blockstar/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 14:09:35 +0000</pubDate>
		<dc:creator>radicality</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[blockstar]]></category>
		<category><![CDATA[cheat]]></category>
		<category><![CDATA[cheatengine]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[tetris]]></category>

		<guid isPermaLink="false">http://vlixter.com/?p=62</guid>
		<description><![CDATA[This is the second, and the better tutorial on how to hack and cheat in the game Facebook Tetris / Blockstar. Use this method instead of the other one posted some time ago. EDIT: Facebook tetris has updated and this, as far as I know, does not work anymore. If you have any ideas, post [...]]]></description>
			<content:encoded><![CDATA[<h4>This is the second, and the better tutorial on how to hack and cheat in the game Facebook Tetris / Blockstar. Use this method instead of the other one posted some time ago.</h4>
<h4><span style="color: #ff0000;">EDIT: Facebook tetris has updated and this, as far as I know, does not work anymore. If you have any ideas, post in the comment section <img src='http://vlixter.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></h4>
<p>Here is the video tutorial, and the shortened text version after the vid.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="345" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.metacafe.com/fplayer/1221762/how_to_hack_cheat_the_facebook_game_tetris_blockstar_v_2.swf" /><param name="wmode" value="transparent" /><embed type="application/x-shockwave-flash" width="400" height="345" src="http://www.metacafe.com/fplayer/1221762/how_to_hack_cheat_the_facebook_game_tetris_blockstar_v_2.swf" wmode="transparent"></embed></object><br />
<span style="font-size: xx-small;"><a href="http://www.metacafe.com/watch/1221762/how_to_hack_cheat_the_facebook_game_tetris_blockstar_v_2/">How to HACK / CHEAT the Facebook Game Tetris / Blockstar (v.2)</a></span></p>
<blockquote><p>Step 1. Download Cheat Engine <a href="http://www.cheatengine.org/downloads/CheatEngine54.exe">HERE</a>.</p>
<p>Step 2. Go to <a href="http://apps.facebook.com/fbtetris/">Facebook Tetris</a>.</p>
<p>Step 3. Install and run Cheat Engine. Click Attach Process in the top left, and select your browser (firefox.exe, iexplore.exe etc)</p>
<p>Step 4. Start playing tetris so that you get any score. Just get something like a 100 and click pause. Go to Cheat Engine. In the Value box, type in your score. For search type select Exact Value, and for Data Type select &#8220;Double&#8221;. Click First Scan. The program will now scan the memory, and it will find from 1-1000 addresses.</p>
<p>Step 5. What you want to do now is go back to Tetris, and unpause the game. Get another couple of points, and pause the game again. Go back to Cheat Engine, and change the value in the Value box to your current score. IMPORTANT: Click Next Scan, and not first scan. Cheat Engine should now 1 address in the address box. If you have more, perform this step again until you find only 1 address.</p>
<p>Step 6. When you do find the 1 address, double click on it. This will add it to the window in the bottom of Cheat Engine. Now Right Click on the address, and select &#8220;Set Hotkey&#8221; or something along the lines of hotkey. You will a window pop up. For the key combination, click anything, I chose the Del key but you can chose anything you want. For the dropdown menu, select &#8220;Increment&#8221;, and for the increment value, put 10000 (IMPORTANT, no more than 10000). Click OK</p>
<p>Step 7. Go back to Tetris and unpause the game. Start playing, and hit the Del key or whatever you set for your hotkey. Your score will now increase by 10000. Keep on clicking delete and playing at the same time. If you just mash the hotkey the game will find out you are cheating. So don&#8217;t overdo it, drop one block, hit the hotkey, and you should easily get &gt;2 million points</p></blockquote>
<p>If the above is not working for you then you did something wrong. Reread the tutorial and watch the video again.</p>
<p>I hope this was useful, and I&#8217;m still working on finding a method to allow you to input any score you want without consequences, so check back the site often.</p>
<p>No go on and get yourself a high Blockstar score!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://vlixter.com/2008/04/05/tutorial-how-to-hack-and-cheat-the-facebook-game-tetris-blockstar/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>TUTORIAL &#8211; How to cheat in Facebook Tetris &#8211; BlockStar Cheating</title>
		<link>http://vlixter.com/2008/03/28/tutorial-how-to-cheat-in-facebook-tetris/</link>
		<comments>http://vlixter.com/2008/03/28/tutorial-how-to-cheat-in-facebook-tetris/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 20:07:31 +0000</pubDate>
		<dc:creator>radicality</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[blockstar]]></category>
		<category><![CDATA[cheat]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[tetris]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://vlixter.com/2008/03/28/tutorial-how-to-cheat-in-facebook-tetris/</guid>
		<description><![CDATA[WARNING: THIS IS THE OLD TUTORIAL. FOR THE NEWER, BETTER VERSION, PLEASE CLICK HERE A friend of mine once asked me how he could cheat in the facebook game Tetris, or Blockstar, so I made a tutorial how to do it in a pretty interesting way. As I&#8217;m no programmer, (well, I hope to improve&#8230;.), [...]]]></description>
			<content:encoded><![CDATA[<p style="color:#FF0000; font-size:25px;"> WARNING: THIS IS THE OLD TUTORIAL. FOR THE NEWER, BETTER VERSION, PLEASE CLICK <a href="http://vlixter.com/2008/04/05/tutorial-how-to-hack-and-cheat-the-facebook-game-tetris-blockstar/">HERE</a> </p>
<p>
A friend of mine once asked me how he could cheat in the facebook game <a href="http://apps.facebook.com/fbtetris/" target="_blank">Tetris</a>, or <a href="http://apps.facebook.com/fbtetris/" target="_blank">Blockstar,</a> so I made a tutorial how to do it in a pretty interesting way. As I&#8217;m no programmer, (well, I hope to improve&#8230;.), this method doesn&#8217;t involve modifying the memory, and is very limited. But hey, if you want to beat someone it can get u that extra 300k points.  I also have a video tutorial if you rather watching than reading, here it goes.
</p>
<p><embed src="http://www.metacafe.com/fplayer/1199425/how_to_cheat_in_facebook_tetris.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> </embed><br /><font size = 1><a href="http://www.metacafe.com/watch/1199425/how_to_cheat_in_facebook_tetris/">How to Cheat in Facebook Tetris</a> &#8211; <a href="http://www.metacafe.com/">For more amazing video clips, click here</a></font></p>
<blockquote><p>Step 1: Install the plugin called <a href="https://addons.mozilla.org/en-US/firefox/addon/115">ReloadEvery</a> for Firefox.</p>
<p>Step 2: Go to www.youtube.com and while holding CTRL, click on like 40 videos you can see on the main page. This will open all of them in a new tab.</p>
<p>Step 3: Right Click anywhere on any page and go to ReloadEvery. Select 5s intervals, and click enable for all tabs. This will make firefox run very slowly, and since there will be so many instances of flash running already, facebook Tetris will be really slow</p>
<p>Step 4: Head over to Facebook Tetris and play it. It will be really slow now. It all matters on your computer. If it&#8217;s not slow enough, open more tabs, if it&#8217;s too slow, close some</p>
</blockquote>
<p>I hope I&#8217;ll find a better method, like one where you can just set your score. For now, thanks for reading and stay tuned for more:)</p>
]]></content:encoded>
			<wfw:commentRss>http://vlixter.com/2008/03/28/tutorial-how-to-cheat-in-facebook-tetris/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
