Click here to Skip to main content
15,888,461 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Find an emtpy entry in a 3x3 grid? Pin
David198718-Jul-11 6:31
David198718-Jul-11 6:31 
GeneralRe: Find an emtpy entry in a 3x3 grid? Pin
Neo1010118-Jul-11 6:47
Neo1010118-Jul-11 6:47 
GeneralRe: Find an emtpy entry in a 3x3 grid? Pin
David198718-Jul-11 7:03
David198718-Jul-11 7:03 
GeneralRe: Find an emtpy entry in a 3x3 grid? Pin
Neo1010118-Jul-11 7:04
Neo1010118-Jul-11 7:04 
GeneralRe: Find an emtpy entry in a 3x3 grid? Pin
Wjousts21-Jul-11 9:45
Wjousts21-Jul-11 9:45 
QuestionCollision detection? [modified] Pin
Neo1010116-Jul-11 4:29
Neo1010116-Jul-11 4:29 
AnswerRe: Collision detection? [modified] Pin
Wjousts21-Jul-11 9:30
Wjousts21-Jul-11 9:30 
QuestionSorting algorithm problem [modified] Pin
Neo1010115-Jul-11 6:56
Neo1010115-Jul-11 6:56 
Hello,

I have a grid with 9 cells, where each cell has a [row,col].

Please see the following image for my problem description:
problem situation

I would like to have the following functionality:

- When you click on one of the circles in the grid,
the clicked circle takes in the place of the only empty square on the grid.
The empty space then in turn switches places with the circle that has just been moved.

Seems easy enough, but I can't figure out how to do this.

My new code is this:
    for (var i = 0; i < borderArray.length; i++) {<br />
        if (borderArray[i].findName('ellipse' + (i + 1)) == null) {<br />
            alert('sr: '+ sender['Grid.Row']);<br />
            alert('sc: ' + sender['Grid.Column']);<br />
            alert('br: ' + borderArray[i]['Grid.Row']);<br />
            alert('bc: ' +  borderArray[i]['Grid.Column']);<br />
<br />
            sender['Grid.Row'] = borderArray[i]['Grid.Row'];<br />
            sender['Grid.Column'] = borderArray[i]['Grid.Column'];<br />
        }<br />
    }


sender[row,col] keeps being 0,0 for some reason, no matter which circle I click on.
It should take the [row,col] value of the sender I clicked. This is strange.
//Edit: fixed this partially. The 'MouseLeftButtonUp' should have been on <border> not on <ellipse>

Languages used:

- JavaScript
- Silverlight

Thank you

modified on Friday, July 15, 2011 1:03 PM

AnswerRe: Sorting algorithm problem Pin
Wjousts21-Jul-11 9:02
Wjousts21-Jul-11 9:02 
GeneralData Pin
Burt12313-Jul-11 10:23
Burt12313-Jul-11 10:23 
GeneralRe: Data Pin
Richard MacCutchan13-Jul-11 21:48
mveRichard MacCutchan13-Jul-11 21:48 
GeneralRe: Data Pin
Burt12314-Jul-11 7:37
Burt12314-Jul-11 7:37 
GeneralRe: Data Pin
Richard MacCutchan14-Jul-11 8:11
mveRichard MacCutchan14-Jul-11 8:11 
QuestionModulo statement Pin
Lutosław5-Jul-11 1:44
Lutosław5-Jul-11 1:44 
GeneralRe: Modulo statement Pin
David19875-Jul-11 2:05
David19875-Jul-11 2:05 
GeneralRe: Modulo statement Pin
BobJanova5-Jul-11 2:38
BobJanova5-Jul-11 2:38 
GeneralRe: Modulo statement Pin
David19875-Jul-11 3:13
David19875-Jul-11 3:13 
GeneralRe: Modulo statement Pin
Lutosław5-Jul-11 2:47
Lutosław5-Jul-11 2:47 
GeneralRe: Modulo statement Pin
David19875-Jul-11 3:06
David19875-Jul-11 3:06 
GeneralRe: Modulo statement Pin
Lutosław5-Jul-11 5:19
Lutosław5-Jul-11 5:19 
GeneralRe: Modulo statement Pin
BobJanova5-Jul-11 5:45
BobJanova5-Jul-11 5:45 
GeneralRe: Modulo statement Pin
David19875-Jul-11 6:03
David19875-Jul-11 6:03 
GeneralRe: Modulo statement Pin
BobJanova5-Jul-11 7:13
BobJanova5-Jul-11 7:13 
GeneralRe: Modulo statement Pin
BobJanova5-Jul-11 3:13
BobJanova5-Jul-11 3:13 
GeneralRe: Modulo statement Pin
David19875-Jul-11 3:14
David19875-Jul-11 3:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.