Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Math problem
#13
(05-05-2023, 07:12 PM)Ottia Tuota Wrote:
(05-05-2023, 04:50 PM)Ofnuts Wrote: But the result are different from mine (seem shifted by 1):

Code:
offset  0, total  15 (   [5, 5, 5]), ofn size  15, ot size  15
offset  1, total  15 (   [5, 5, 5]), ofn size  15, ot size  14
offset  2, total  14 (   [5, 5, 4]), ofn size  14, ot size  14
offset  3, total  14 ([1, 5, 5, 3]), ofn size  14, ot size  14
offset  4, total  14 ([2, 5, 5, 2]), ofn size  14, ot size  14
offset  5, total  14 ([3, 5, 5, 1]), ofn size  14, ot size  14
offset  6, total  14 (   [4, 5, 5]), ofn size  14, ot size  15

In that example, what are the values of the arguments span, tile, grid?

To check the results, one should draw a picture on paper and count by hand. But I notice that both your and my results contain two 15's and five 14's, so that could it be that the offset has different meanings?

Same is the the part of the answer of Programmer_Ceds (so the small diagram also applies): space is 5, line is 2, width is 20 (and I remove the lines and want to keep the spaces, so I swapped a & s because your code seems to do the opposite). In the listing above, total is the result of code that iterates (and is followed by the decomposition). I somehow trust it (and my non-iterative code) because my manual checks were OK (after some debugging...) and I have ascript based on it that would give wrong results otherwise.

If I change the code to use the same as you (ie, a is lines, and s is space) and return the window with minus what you compute (so, normally, window-lines=spaces) I get the same values but shifted differently:

Code:
offset  0, total  15 (   [5, 5, 5]), ofn size  15, ot size  14,
offset  1, total  15 (   [5, 5, 5]), ofn size  15, ot size  15,
offset  2, total  14 (   [5, 5, 4]), ofn size  14, ot size  15,
offset  3, total  14 ([1, 5, 5, 3]), ofn size  14, ot size  14,
offset  4, total  14 ([2, 5, 5, 2]), ofn size  14, ot size  14,
offset  5, total  14 ([3, 5, 5, 1]), ofn size  14, ot size  14,
offset  6, total  14 (   [4, 5, 5]), ofn size  14, ot size  14,

A graphical solution (5px spaces, 2px lines, 20px width):

Code:
SSSSSLLSSSSSLLSSSSSLLSSSSSLL 0|7: 15
--------------------
       --------------------
12345678901234567890

SSSSSLLSSSSSLLSSSSSLLSSSSSLL 1: 15
      --------------------
12345678901234567890

SSSSSLLSSSSSLLSSSSSLLSSSSSLL 2: 14
     --------------------
12345678901234567890

SSSSSLLSSSSSLLSSSSSLLSSSSSLL 3: 14
    --------------------
12345678901234567890

SSSSSLLSSSSSLLSSSSSLLSSSSSLL 4: 14
   --------------------
12345678901234567890

SSSSSLLSSSSSLLSSSSSLLSSSSSLL 5: 14
  --------------------
12345678901234567890

SSSSSLLSSSSSLLSSSSSLLSSSSSLL 6: 14
 --------------------
12345678901234567890
Reply


Messages In This Thread
Math problem - by Ofnuts - 05-02-2023, 08:45 AM
RE: Math problem - by PixLab - 05-03-2023, 08:47 AM
RE: Math problem - by rich2005 - 05-03-2023, 10:17 AM
RE: Math problem - by Ofnuts - 05-04-2023, 10:51 AM
RE: Math problem - by rich2005 - 05-04-2023, 11:05 AM
RE: Math problem - by Ofnuts - 05-04-2023, 11:45 AM
RE: Math problem - by programmer_ceds - 05-04-2023, 05:33 PM
RE: Math problem - by rich2005 - 05-04-2023, 12:27 PM
RE: Math problem - by Ofnuts - 05-04-2023, 12:58 PM
RE: Math problem - by Ottia Tuota - 05-04-2023, 05:34 PM
RE: Math problem - by Ofnuts - 05-05-2023, 04:50 PM
RE: Math problem - by Ottia Tuota - 05-05-2023, 07:12 PM
RE: Math problem - by Ofnuts - 05-05-2023, 08:04 PM
RE: Math problem - by programmer_ceds - 05-05-2023, 09:53 PM
RE: Math problem - by Ofnuts - 05-05-2023, 10:54 PM
RE: Math problem - by Ottia Tuota - 05-06-2023, 08:23 AM
RE: Math problem - by programmer_ceds - 05-06-2023, 10:22 AM
RE: Math problem - by Ottia Tuota - 05-06-2023, 07:52 PM
RE: Math problem - by Ofnuts - 05-06-2023, 09:05 PM

Forum Jump: