Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

metrics calc

Status
Not open for further replies.

AIXFinder

IS-IT--Management
Joined
Jan 4, 2007
Messages
97
Location
US
I like to calculate numbers based on the following metrics:

There will be input strings for the horizontal and vertical lines.

The assigned numbers for each input string will increase by 1 vertically and horizontally.

i.e.

0 1 2 3 4 5

1

2

3

so, if the input strings for the horizontal are: X Y X W Z respectively
and the input strings for the vertical are: X W Y respectively

then, it will be:

X Y X W Z
0 1 2 3 4 5

X 1

W 2

Y 3

The calculation logics with for each cell are:

1) the number assigned vertical + 1 (= always increased by 1)
2) the number assigned horizontal + 1 (= always increased by 1)
3) for the diagonal, if the input string is the same, then no change
if the input strings are different, the diagonal + 1

then, choose the smallest number and then display.

so, if I illustrate these logics with the example above:

the very first cell ( X, X)
• the number assigned vertical =1 + 1 = 2
• the number assigned horizontal = 1 + 1 = 2
• the number assigned diagonal = 0 + 0 (because X =X) =0
so, choose 0 (the smallest)

the next cell ( X, W) to down
• the number assigned vertical =0 (this is the smallest number vertical chosen from the cell above) + 1 = 1
• the number assigned horizontal = 2 + 1 = 3
• the number assigned diagonal = 1 + 1 (X != W) =2
so, choose 1 (the smallest)


the next cell ( X, Y) to down
• the number assigned vertical =1 (this is the smallest number vertical chosen from the cell above) + 1 = 2
• the number assigned horizontal = 3 + 1 = 4
• the number assigned diagonal = 1 + 1 (X != Y) =2
so, choose 2 (the smallest)


For the first cell in the second column, ( Y, X)
• the number assigned vertical =2 + 1 = 3
• the number assigned horizontal = 0 (this is the smallest number vertical chosen from the cell left) + 1 = 1
• the number assigned diagonal = 1 + 1 (Y != X) =2
so, choose 1 (the smallest)


the next cell ( Y, W) to down
• the number assigned vertical =1 (this is the smallest number vertical chosen from the cell above) + 1 = 2
• the number assigned horizontal = 1 + 1 = 2
• the number assigned diagonal = 0 (this is the number diagonal chosen from the cell diagonal) + 1 (Y != W) =1
so, choose 1 (the smallest)

the next cell ( Y, Y) to down
• the number assigned vertical =1 (this is the smallest number vertical chosen from the cell above) + 1 = 2
• the number assigned horizontal = 2 (this is the smallest number horizontal chosen from the cell left) + 1 = 3
• the number assigned diagonal = 1 (this is the number diagonal chosen from the cell diagonal) + 0 (Y = Y) =1
so, choose 1 (the smallest)

and repeat the same logic.

Can you help me on getting started?

thx so much
 
is this school work?

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
this is my work related.

thx
 
OK, have you written any code at all so fa? Do you know some perl?

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top