NavMenu

Monday, August 30, 2010

Working with Arrays: Array.IndexOf

In my Sudoku project, I'm working a lot with arrays and ArrayLists.  Searching an array for things like a value (e.g. a matching digit of 1-9) or an open spot (e.g. open tile in column) can be cumbersome.  At first I was for statements often.

But then I discovered Array.IndexOf.  The syntax is straightforward Array.IndexOf(arrayName, objectValueToSearchFor). It searches one-dimensional array, starting with the first element (i.e. 0, remember arrays are zero-based) and ending with the last element..  Each element is compared to the specified objectValueToSearchFor. If it finds it, it returns the first element location. 

kick it on DotNetKicks.com

Shout it

Saturday, August 28, 2010

First C# Project - Sudoku

I finished studying the C# basics up to Collections and thought it was time to test what I've learned so far.  What better way to test myself than to build a project from scratch.  I love playing Sudoku and have an assortment of the magazine books.  I chose to build a project that did the following:

  1. User loads in a beginning board (just like the game books), as a starting point.
  2. Then the SolverEngine runs through a series algorithms to solve each row, column, quad, and then finally the entire board.

kick it on DotNetKicks.com

Shout it

Starting my blog

This is my first blog post...ever.  Hum, where to start?  Let's start with what the blog is about.

kick it on DotNetKicks.com

Shout it

About

My photo
Welcome to my blog! This blog is about my journey to become a Master .NET coder and teacher.

Followers