Interesting 8x8 chess board counting problem

Click For Summary
SUMMARY

The discussion centers on calculating the number of distinct paths a rook can take from the bottom left to the top right corner of an 8x8 chessboard, given it can move any number of squares up or to the right. The total number of paths is determined to be 3432, which can be derived using the binomial coefficient C(14,7). This reflects the fact that regardless of whether the rook moves one square at a time or multiple squares, the distinct paths remain the same. The problem can be approached through recursion or memoization techniques to efficiently compute the number of paths.

PREREQUISITES
  • Understanding of combinatorial mathematics, specifically permutations and combinations.
  • Familiarity with recursion and memoization techniques in programming.
  • Basic knowledge of binomial coefficients and their applications.
  • Experience with dynamic programming concepts for solving counting problems.
NEXT STEPS
  • Study the concept of binomial coefficients and their applications in combinatorial problems.
  • Learn about recursion and memoization in programming, particularly in Python or Java.
  • Explore dynamic programming techniques for solving pathfinding problems on grids.
  • Investigate the application of Pascal's triangle in combinatorial mathematics.
USEFUL FOR

Mathematicians, computer scientists, and anyone interested in combinatorial optimization or algorithm design, particularly those working on pathfinding algorithms in grid-based systems.

  • #61
To jbriggs444.
Good, good, good.
So in every element of the array, there is a number. And the number represents how many path to the solution. In the end it's a matter of memory vs process. I remember the case once in finding prime number.
Well, well, well, jbriggs444, you never cease to amaze me!.
I always find good explanations from you!.
I don't know whether you're a good scientist, physicist or a good computer programmer.
But one thing for sure, you're a damn GOOD TEACHER!. Bravo!
 
Mathematics news on Phys.org
  • #62
#!/usr/bin/perl
#
# Iterative approach. Populate n by n array
#
Foolish of me. Of course, perl!
 
  • #63
Code:
for $i ( 1 .. $row-1 ) {
  $ways = $ways + $count[$i][$column];
};
for $i ( 1 .. $column-1 ) {
  $ways = $ways + $count[$row][$i];
};
I'm sorry jbriggs444,
I think that line of code should be changed to:
Code:
if ($Row>1) $ways = $ways + $count[$Row-1][$column];
if ($Col>1) $ways = $ways + $count[$Row][$column-1];
Thanks for your explanations!

For QueenMode

Code:
if ($Row>1) $ways = $ways + $count[$Row-1][$column];
if ($Col>1) $ways = $ways + $count[$Row][$column-1];
if ($QueenMode && ($Row>1) && ($Col>1)) $ways = $ways + $count[$Row-1][$column-1];

Ahhh, PhysicsForums is suck!
Why there's no "Pascal" option in insert code. From all languages, they have FORTAN! :smile:
 
  • #64
Stephanus said:
Code:
for $i ( 1 .. $row-1 ) {
  $ways = $ways + $count[$i][$column];
};
for $i ( 1 .. $column-1 ) {
  $ways = $ways + $count[$row][$i];
};
I'm sorry jbriggs444,
I think that line of code should be changed to:
Code:
if ($Row>1) $ways = $ways + $count[$Row-1][$column];
if ($Col>1) $ways = $ways + $count[$Row][$column-1];
That depends on what problem you are trying to solve. The program correctly solves the problem it was intended to solve. That problem being finding the number of distinct sequences of [eastward and northward] rook moves that can go from one corner to the other of an i by j chessboard.

If you want to determine the number of paths, the recurrence does indeed become much simpler. The distinction between the number of paths and the number of sequences of moves has been pointed out multiple times in this thread.
 
  • Like
Likes Stephanus
  • #65
You are on 1,1 to get on 8,8 you have to move 7 steps along x-axis and 7 steps along the y axis. Since we can't "back off" therefore whenever we will make a move we will add "1" to the value of x or that of y. Let's write "x" for move along x axis, and "y" for that along y axis. Now each possible path can be associated uniquely with a sequence of seven x's and seven y's. e.g., xxxyyyxyxyxyyx is one the possible path, fortunately there is one to one correspondence between the possible arrangement and no. of paths, now finding former is simple its just purmutation of 14 thing seven of one kind and rest of other kind, this no. is just equal to 14!/7!*7!.
On solving gives 3432.
 

Similar threads

  • · Replies 20 ·
Replies
20
Views
7K
  • · Replies 13 ·
Replies
13
Views
2K
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
3
Views
3K
  • · Replies 25 ·
Replies
25
Views
5K
Replies
4
Views
5K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K