Showing posts from November, 2011

Using recursion to do permutations

Solving problems using recursion.
 I have always had problems in understanding deep and complex recusion eventhough they all follow a common pattern that  is There is always a base case to stop the recursion and making a recursive call on some smaller part of the solution, I decided to set my bar high . Here are the things i set to use recursion to understand complex recursive calls .

Solving Sudoku using BacktrackingThe Chess  Knight - Queen classicPermutationsMore problems as I come across.
Let start with the case that allows you to select all possible combinations of all members a set. I learnt that this recursive pattern in very important to understand because the is a common pattern used in solving the problems that I mentioned above and many others like searching and solving word puzzles
  I define  permutations as all the ways to arrange a set of items for example if you permute the word {cat} you get {cat, tac, act, atc, tca, cta}. Permutations are mathematic…

Using design patterns to build part of a soccer game engine

My goal here is to see if  I can use and understand design patterns and use them to solve a real world problem. I started by first learning the singleton pattern  and used it in my Dynamic quiz application using MVC and Entity Framework Code First. I want to design a soccer game engine .Its a big a complex problem to solve but the best way to solve such a problem is to divide it into smaller parts that contains all components of building a soccer game engine. For this post I will focus on the problem of letting the referees  and players know the current position of the ball always .I play soccer and love soccer so lets get real now to see what will be needed for this
A soccer game must have a ballThey are 11 players in each teamThere are two teamsTwo  lines men and one refereeEach team has reserve playersThere is the playground of courseThe ball is the center of attention and  everybody of interest for that game wants to know where the ball is and whats happening to it . Who  a…

Building a dynamic quiz application in MVC

The quiz application I have build works just like that of W3Schools I got the inspiration from here and I wanted to understand more on MVC scafolding and Entity framework Code first. I set on my journey to write the application. Here is how it should work.
The user goes to the quiz page to take the quiz The quiz has a question and a list of answers choices to choose from. When the user clicks on the next button , a new question is loaded dynamically. When the questions are completed the user is sent to a page showing his or her results. Some ASP.Net MVC stuff I used code first method by making poco classes and scaffolded all my controllers and i got all my CRUD methods an views for the controllers I choosed. MVC Entity framework now the default database object relational mapper for the framework.To know more about Code first and the new scaffolding in MVC check out this link.Scaffolding and Entity framework code first The next thing for me was to…