Need suggestions for developing Scrabble like game in WPF
-
Hi I want to develop a game like Scrabble in WPF for which I need some suggestions For Visuals: 1. What controls can be utilized to represent a (let's say 9 x 9) matrix? I would need ability to associate each cell with an id to know its state at all times during execution. 2. How can I inject different visual properties to a cell of matrix? 3. Would I need something like separate layers for base board, and tiles? For logic: 4. How to go about validating a word and possible words around it? Please advise. Thanks PJ
Follow your goals, Means will follow you ---Gandhi---
-
Hi I want to develop a game like Scrabble in WPF for which I need some suggestions For Visuals: 1. What controls can be utilized to represent a (let's say 9 x 9) matrix? I would need ability to associate each cell with an id to know its state at all times during execution. 2. How can I inject different visual properties to a cell of matrix? 3. Would I need something like separate layers for base board, and tiles? For logic: 4. How to go about validating a word and possible words around it? Please advise. Thanks PJ
Follow your goals, Means will follow you ---Gandhi---
mittalpa wrote:
1. What controls can be utilized to represent a (let's say 9 x 9) matrix? I would need ability to associate each cell with an id to know its state at all times during execution.
You could use a simple grid for this. I wouldn't worry about associating the cell with an id to know its state - keep track of this with your model instead. It's a much better mechanism for this as you can use binding to keep associate it with the visuals. You've already worked out that you are going to use a matrix, so you know that you can just represent the word on the board with the matrix.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
Hi I want to develop a game like Scrabble in WPF for which I need some suggestions For Visuals: 1. What controls can be utilized to represent a (let's say 9 x 9) matrix? I would need ability to associate each cell with an id to know its state at all times during execution. 2. How can I inject different visual properties to a cell of matrix? 3. Would I need something like separate layers for base board, and tiles? For logic: 4. How to go about validating a word and possible words around it? Please advise. Thanks PJ
Follow your goals, Means will follow you ---Gandhi---
mittalpa wrote:
1. What controls can be utilized to represent a (let's say 9 x 9) matrix? I would need ability to associate each cell with an id to know its state at all times during execution.
Like the other guy said, use a Grid (or DataGrid or ListView or a custom control) and modify your view model when dealing with state.
mittalpa wrote:
2. How can I inject different visual properties to a cell of matrix?
Use properties on your view model to determine what your view displays. WPF is rich with ways of dealing with what to display, such as template selectors.
mittalpa wrote:
3. Would I need something like separate layers for base board, and tiles?
WPF allows you to layer things easily. However, you wouldn't necessarily NEED to layer... might make some things easier though.
mittalpa wrote:
4. How to go about validating a word and possible words around it?
There are word lists you can download for free. There is one from an old version of a dictionary (1916 Merriam Webster?), for example, that you could download, parse, and use when validating that the words used are valid. You could also create a web crawler to find words on the Internet... and you could allow users to enter their own words. As far as the validation logic itself, just focus on the view model rather than the view.