Category Archives: games

Solution to puzzle: Zero rows and columns in an array in C#

This post gives four solutions to Puzzle: Zero rows and columns in an array in C#. If you want to try the puzzle for yourself, see that post before you read this one. This is a fairly long post, but … Continue reading

Posted in arrays, games | Tagged , , , , , , , , , | 3 Comments

Puzzle: Zero rows and columns in an array in C#

This puzzle is given as a coding example in the book Cracking the Coding Interview by Gayle Laakmann McDowell. The puzzle is: Write an algorithm such that if an element in an M x N matrix is 0, its entire … Continue reading

Posted in arrays, games | Tagged , , , , , , , , | 1 Comment

Book Review: Super Scratch Programming Adventure!: Learn to Program By Making Cool Games

Super Scratch Programming Adventure! Learn to Program By Making Cool Games $24.95, 160 pages, 2012 By the LEAD Project No Starch Press ISBN 13: 978-1593274092 A great, non-threatening introduction to programming This book’s subtitle is, “Learn to program by making … Continue reading

Posted in books, games | Tagged , , , , , | Leave a comment

Make silly eyes that track the mouse without flicker in C#

The example Make silly eyes that track the mouse in C# shows how to make eyes track the mouse position, but if you look closely as that program runs you will see a noticeable flicker. The solution is quite simple: … Continue reading

Posted in games, geometry, graphics | Tagged , , , , , , , , , , , , | 1 Comment

Make silly eyes that track the mouse in C#

This example uses a Timer named tmrTick to track the mouse. Its Tick event handler, which is shown in the following code, updates the eyes. // The previous mouse location. private Point OldMousePos = new Point(-1, -1); // See if … Continue reading

Posted in games, geometry, graphics | Tagged , , , , , , , , , , , , | 1 Comment

Solution: The 40 pound stone puzzle

  This is the solution to The 40 pound stone puzzle. If you haven’t read the puzzle yet, click here before you read the solution. This puzzle similar to some of the puzzles in my book Interview Puzzles Dissected. The … Continue reading

Posted in algorithms, books, games, puzzles | Tagged , , , , , , , , | Leave a comment

Puzzle: The 40 pound stone

This is a variation of a puzzle given on Car Talk. It’s similar to some of the puzzles in my book Interview Puzzles Dissected. A farmer uses a double-pan balance and a 40 pound stone to measure 40 pound weights: … Continue reading

Posted in algorithms, books, games, puzzles | Tagged , , , , , , , , | Leave a comment

Make the basis for a card game in C#

The goal of this example is to provide some support for building a card game. It shows how to make a class to represent cards and to to tell what card is displayed in a PictureBox. It’s actually relatively straightforward. … Continue reading

Posted in games, graphics, image processing, puzzles | Tagged , , , , , , , , , , , , | Leave a comment

Verify sizes of playing cards in C#

Recently I wanted to use some playing cards in a program so I looked online for some nice images. I could have included 55 or so separate images (including jokers and backs), but I decided it would be easier to … Continue reading

Posted in games, graphics, image processing, puzzles | Tagged , , , , , , , , , , , | Leave a comment

Make a hangman game in C#

Special thanks to Jeff Scarterfield for the skeleton drawing used by the program. This example builds a simple hangman game that uses the dictionary created by the example Use LINQ to select words of certain lengths from a file in … Continue reading

Posted in algorithms, files, games, graphics, strings | Tagged , , , , , , , , , , , , | Leave a comment