Saturday, October 16, 2010

Sudoko Solver

Wrote a small application to solve a Suduko puzzle in C#, I was doing C# coding after some years now and I thoroughly enjoyed it

If you are interested you may wont to give it a try.

Step 1: Make a grid of text boxes (81 of them !!! ), load it into an array of objects
Step 2: Write function checkRow to see if no two numbers are repeated
Step 3:Write function checkColumn
Step 4:Write function checkBox
Step 5:Write function findAllPossible(for a particular position)
Step 6:Write function findAll(for all 81 position)
Step 7: Check is their a number in a row which is allowed only in that position, then that number is to be placed there
Step 8: Check is their a number in a column which is allowed only in that position, then that number is to be placed there
Step 9: Check is their a number in a box which is allowed only in that position, then that number is to be placed there
Step 10:Do color coding for duplicates. Make new entries come in green or something

Future Enhancements : Undo, History, Game Generation, Guessing in case direct solving does not work

Time : ~15 hours of coding ..... more because there was many things I was not sure how to do in C#, because of the gap ... try it, it is fun

Thursday, August 26, 2010

Code Guru : Gateways 2010

Conducted Code Guru in Christ University for the MCA/M.Sc Students. There was 4 questions and an hour to code and get them executing. This time top three were able to do all four questions in the allotted time and competition ended up as a nail biting finish for the IInd and IIIrd place.

Winners are :
1. Aditya Gopalakrishnan
2. Heena Gupta
3. Mahesh D
4. Rakesh Kashyap
5. Jyothsna K
6. Andrew Pereira
7. Raju K
8. Lakshmi Narayanan
9. Sowmya Stephen
10. Mark Godfrey

Time : 1 Hour
Compiler : C/C++/Java/.Net
Questions :
1. Convert a mixed string to alternate upper and lower case
2. Validate a date in mm-dd-yy and convert to dd-mm-yy
3. If user enters 2 (line) 3 (triangle) 4 (square) 5 (pentagon)
4. Create a game which is like a puzzle
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15

1 2 3 4
5 6 7
9 10 11 8
13 14 15 12
User should be able to move left,right,up,down,randomise and sort the puzzle

Questions prepared by J S Saleema, Deepthi Das, Jibrael Jos

Monday, July 5, 2010

Coding is Fun



When I joined CMC in 1996 there was in my class Ashish Patkar and Neeraj Parashar who already knew coding quiet well and even though I had coded in Basic and Pascal, I knew they both were much ahead of the game.

Rajesh and I , were given challenge problems to code from these two stalwarts and two programs which I remember coding was the "Lift","Cross and Knots", "PingPong". Another program Arun and I had coded in those days was "Cows and Bulls".

We loved coding it and today I give similar problems to students in Christ University.

We all work in different organisations and different cities now but I am sure wherever we are we all will agree that coding is fun

(Lift Coded by Kitti, Ping Pong coded different versions by Sr Smitty , Amit, Gaurav , Jabez, Sufian)

Monday, February 15, 2010

Code Guru : Revelation 2010

Conducted a programming competition to identify the Top 5 coders in MCA /M.Sc Programs running here in the Department of Computer Science at Christ University. There was a very good response for the same

The students were to code these directly onto their laptops in any language of their choice. As each question was completed the times were noted for each individual

They could only move to next question after completing current level.

Top 5 (in order) : Nibedita S, Raju K, Mahesh K, Aditya G, Rakesh K,

Rank 6-10 : Heena S, Mac, Karan B, Neha S, Leo
The questions were
Question 1
Ask user to input 10 number into an array A
Prepare two arrays(O,E) one which contains odd and one which contains even

Question 2
Take a string, Implement a code such that
All characters are right shifted by 3.
So “CAT” will become “FDW”

Additionally all words length are reversed
“THIS IS A CAT” (4,2,1,3)

would be
WKL V LV DFDW (3,1,2,4)

Question 3
If user inputs a number it should display the number in big form eg .1,3
*
*
*
*
*
Implement for all 10 digits

Question 4
Find all combination for 4 digit number
Eg. for 3 digit number : 123
123,231,312,213,132,321
Higher marks for better algo

Question 5
On a chess board you want to place 4 rooks and 4 bishop such that no two pieces cut each other
Rook Moves side ways, forward and back
Bishop moves diagonal
Can you write a program to find any eight places

Question 6
Modify program 2 such that height can be defined