Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!

# can't find the logic

riris wijaya
Greenhorn
Posts: 7
hy all, i can't figure out the logic of this

The position of A and B is random. And A and B is linked by *. What is the logic of this?? do i have to make an array 10 x 10, and access the index randomly to put A??? or what??

Mohana Rao Sv
Ranch Hand
Posts: 485
what is the actual assignment, find the A and B positions and putting *'s? If so first of all find exact location of 'A' and 'B', then put the star's.

riris wijaya
Greenhorn
Posts: 7
The assignment is to place A and B randomly, and connect it with *. So, whenever the program is run, the position of A and B is change and linked with *.

Campbell Ritchie
Sheriff
Posts: 50733
83
• 1
Pencil and paper. That’s what you need. Write down an explanation of how you would do that. Once you have got it into very simple words (pseudo-code), it will be easy to convert to code.

tarun mall
Greenhorn
Posts: 13
riris wijaya wrote:hy all, i can't figure out the logic of this

The position of A and B is random. And A and B is linked by *. What is the logic of this?? do i have to make an array 10 x 10, and access the index randomly to put A??? or what??

The solution is pretty easy ;)

1. Fill A's row till B's column
2. Fill B's column till A's row

riris wijaya
Greenhorn
Posts: 7
i have found the way to place A and B randomly. Here is my scrip

but still, i can conect A and B with *. Is there any suggestion???

Jeff Verdegan
Bartender
Posts: 6109
6
riris wijaya wrote:
but still, i can conect A and B with *. Is there any suggestion???

Campbell Ritchie wrote:Pencil and paper. That’s what you need. Write down an explanation of how you would do that. Once you have got it into very simple words (pseudo-code), it will be easy to convert to code.

dennis deems
Ranch Hand
Posts: 808
My suggestion is to scrap what you have done, turn off the computer, and follow Campbell's suggestion of solving the problem with pencil and paper. If you really do this, then writing the code will be simple. Well, okay I have a second suggestion: use the power of objects!

Darryl Burke
Bartender
Posts: 5149
11