Welcome to Techtadka
Get Water
This game is the famous WaterJug problem. You must have heard about it if not then the below is the description of it.
In this game you have to read the puzzle question at every screen show above. You will be given 2 jug or 3 jug and using them you have to get the required amount of water. You have unlimited amount of water in store.
Lets take example: Get 1 Litres of water from 2 jug with capacity of 3Litres and 5 Litres.
Step 1: Drag Jug with 5 Litres Capacity(Bigger Jug) below the tap to get it filled and drop it. It will be filled automatically.
Step 2: Drag filled Jug with 5 Litres Capacity (Bigger Jug) above the smaller jug until a arrow is displayed. Leave the jug there. The water will be filled in the smaller jug and rest water will remain in the bigger jug.
Step 3: Drop the smaller jug to the sink and then drop it over there. The water will go inside the sink and smaller jug will be empty.
Step 4: Now Drop the bigger jug again above the smaller jug and water will be filled in smaller jug with 2 Litres of water.
Step 5: Now again fill the bigger jug with water by bringing the water beneth the tap.
Step 6: Bring the upper jug above the smaller jug. Now the smaller jug contains the 3 Litres and bigger jug contains 4 Litres that is mentioned below the respective jugs.
Step 7: Empty the smaller jug by dropping it above the sink.
Step 8: Now pour the bigger jug water into the smaller jug by bringing the bigger jug above the smaller jug.
You won with this step. Now the bigger jug contains the 1 Litre of water.
This game is just a simulation of the famous Water Jug Problem.
To enhance the skills just download and enjoy the app.
Web Crawler in Java
A very basic webcrawler source code in java:-
The source code for the webcrawler for getting stated with the web parsing projects.
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class Crawler
{
public static void main(String argv[]) {
URL url = null;
try {
url = new URL("http://www.google.com");
URLConnection urlConnection = url.openConnection();
urlConnection.setAllowUserInteraction(false);
InputStream urlStream = url.openStream();
//urlConnection.guessContentTypeFromStream(urlStream);
byte b[] = new byte[4];
int numRead = urlStream.read(b);
String content = new String(b, 0, numRead);
while (numRead != -1)
{
numRead = urlStream.read(b);
if (numRead != -1)
{
String newContent = new String(b, 0, numRead);
content += newContent;
}
}
urlStream.close();
System.out.println(content);
} catch (Exception e) {
e.printStackTrace();
}
}
}
In this code a url is crawled and the source code of the webpage(http://www.google.com) is stored in the string and then it is displayed by the system.out.println()








