Results 1 to 1 of 1
- 05-06-2012, 01:26 PM #1Member
- Join Date
- May 2012
- Rep Power
All possible placements of n mirrors in a grid
For an assignment from school we have to build a grid and find a correct placement of mirrors in the grid
so that light would come in at one cel (of the grid) and leave at another cel.
Now my idea was to build a grid, place numbers around it for in and out,
and check for any set up of mirrors if it is correct.
If a set up is correct it is returned and the program terminates.
I did most of this, i.e. I can check for a given positioning of mirrors if it is correct given the in and out. But now I am stuck on how to generate all the possible positionings given a grid and n mirrors.
Can anyone give me tips on how to do this?
I was thinking of 2D arrays that store either -1, 0, or 1 in each array location
(-1 for / , 0 for nothing and 1 for \). The problem is finding a way to generate all possible combinations of
-1, 0 and 1 in such 2D array.
Last edited by Lucato; 05-06-2012 at 01:29 PM.
- By java software in forum Java SoftwareReplies: 0Last Post: 03-27-2012, 08:00 PM
- By ranss41 in forum New To JavaReplies: 0Last Post: 01-06-2012, 05:41 PM
- By samanyu in forum Java GamingReplies: 5Last Post: 07-14-2011, 02:54 AM
- By jazz2k8 in forum Advanced JavaReplies: 2Last Post: 11-06-2008, 03:11 PM
- By willemjav in forum Java AppletsReplies: 5Last Post: 06-14-2008, 07:59 PM