Saturday, March 16, 2013

Tic Tac Toe AI Techniques

Tic Tac Toe AI Techniques

This is a basic tic tac toe game for windows. It is based on Artificial Intelligence technique called Min-Max procedure. It is developed in C++ using OpenGL glut library for graphics.
Below is the link showing the working of game:



Techgig programming problem - Find the slope

Find the slope

Problem Statement
Question here is that you are given range of number (A to B) and you have to tell the sum of slope of all the number between A and B.
Now we define the term slope of a number N. Slope of a number N is the number of digits (excluding the first and the last digit) which is either maxima or minima in that number.
Consider a number N. A digit in number N is called minima if it is smaller than both of its neighbour and a digit is called maximaif it is larger than both of its neighbour. 
In case of wrong ranges or unexpected ranges, please return output as -1
Input Specification:

Input 1 specifies the starting range of numbers. It will be of integer type
Input 2 specifies the ending range of numbers. It will be of integer type
Output Specification:

sum of slope value of all the number in the given range . Output will be of integer type
In case of wrong ranges or unexpected ranges, please return  output as -1

Examples:

Example 1 : Consider the range 1-100 in this range all the numbers are either one digit or 2 digit so the slope value of all the number is zero and hence the sum is zero. 

Similarly, consider the range 100-150 the sum of slope of all the number in this range is 19
Example 2 : Consider the number 54698 in range 54698-54800. In this number 4 is a minima because it is smaller than it both neighbor i.e. 5 and 6. similarly digit 9 is a maxima because it is grater than both of its neighbor i.e. 6 and 8. 

Slope of 54698 is 2 because it has 4 as minima and 9 as maxima and there is no other minima or maxima. 

Similarly we check next numbers in the range 54698-54800 and sum of slope of all the numbers will be the output.

Tuesday, January 3, 2012

The working of a Keylogger

A keylogger is a software that keeps record of keystrokes of users. It can act as a trojan virus.
How it Works:-
When a user starts typing, it keeps track of keys pressed and save these keys in a file. Most text files are used to store the keystrokes. The text file is sent to the attacker via email or ftp uploading. So attacker can download and view text file. Most advanced keyloggers store additional information of keystrokes i.e. time and date of keys typed or name of user's computer etc.
How it can be a threat:-
This is an attack on one's privacy and confidentiality of information. Attacker can compromise user email, credit accounts by knowing the password. If you think further, it can cause havoc.
Prevention:-
To protect yourself, don't install untrusted softwares from untrusted websites or users.
Install an anti-virus and firewall on your pc or laptop.
A video showing the working of a keylogger:-