diff options
| author | Paulo Custodio <pauloscustodio@gmail.com> | 2021-03-09 20:01:18 +0000 |
|---|---|---|
| committer | Paulo Custodio <pauloscustodio@gmail.com> | 2021-03-09 20:01:18 +0000 |
| commit | c51f9bd979dbd79f20cb0abd543dc9b4df9f4e84 (patch) | |
| tree | 9133aa3fc3d107c7b44de3905fc7b1d2ab307aaa /challenge-101/paulo-custodio/basic | |
| parent | bfa8b8a3dda2ac37c22c7f4fc2867211f92f65e0 (diff) | |
| download | perlweeklychallenge-club-c51f9bd979dbd79f20cb0abd543dc9b4df9f4e84.tar.gz perlweeklychallenge-club-c51f9bd979dbd79f20cb0abd543dc9b4df9f4e84.tar.bz2 perlweeklychallenge-club-c51f9bd979dbd79f20cb0abd543dc9b4df9f4e84.zip | |
Remove tabs
Diffstat (limited to 'challenge-101/paulo-custodio/basic')
| -rw-r--r-- | challenge-101/paulo-custodio/basic/ch-1.bas | 28 | ||||
| -rw-r--r-- | challenge-101/paulo-custodio/basic/ch-2.bas | 8 |
2 files changed, 18 insertions, 18 deletions
diff --git a/challenge-101/paulo-custodio/basic/ch-1.bas b/challenge-101/paulo-custodio/basic/ch-1.bas index f958245d3e..e68f212358 100644 --- a/challenge-101/paulo-custodio/basic/ch-1.bas +++ b/challenge-101/paulo-custodio/basic/ch-1.bas @@ -1,14 +1,14 @@ ' Challenge 101 -' +' ' TASK #1 › Pack a Spiral ' Submitted by: Stuart Little -' +' ' You are given an array @A of items (integers say, but they can be anything). -' -' Your task is to pack that array into an MxN matrix spirally counterclockwise, +' +' Your task is to pack that array into an MxN matrix spirally counterclockwise, ' as tightly as possible. -' -' ‘Tightly’ means the absolute value |M-N| of the difference has to be as small +' +' ‘Tightly’ means the absolute value |M-N| of the difference has to be as small ' as possible. const max_numbers as integer = 100 @@ -19,12 +19,12 @@ dim shared num_width as integer, rect_width as integer, rect_height as integer dim shared num_numbers as integer ' collect from command line -sub collect_numbers() +sub collect_numbers() dim i as integer i = 1 do while command(i)<>"" number_list(i) = val(command(i)) - if len(command(i))>num_width then + if len(command(i))>num_width then num_width = len(command(i)) end if num_numbers = i @@ -56,13 +56,13 @@ sub pack_numbers(rect_width as integer, rect_height as Integer) number_rect(row, col) = -1 next next - + idx = 1 row = rect_height col = 1 do while idx <= num_numbers ' go East - do while col <= rect_width + do while col <= rect_width if number_rect(row, col) >= 0 then exit do number_rect(row, col) = number_list(idx) idx = idx + 1 @@ -70,7 +70,7 @@ sub pack_numbers(rect_width as integer, rect_height as Integer) loop col = col - 1 row = row - 1 - + ' go North do while row >= 1 if number_rect(row, col) >= 0 then exit do @@ -80,7 +80,7 @@ sub pack_numbers(rect_width as integer, rect_height as Integer) loop row = row + 1 col = col - 1 - + ' go West do while col >= 1 if number_rect(row, col) >= 0 then exit do @@ -90,9 +90,9 @@ sub pack_numbers(rect_width as integer, rect_height as Integer) loop col = col + 1 row = row + 1 - + ' go South - do while row <= rect_height + do while row <= rect_height if number_rect(row, col) >= 0 then exit do number_rect(row, col) = number_list(idx) idx = idx + 1 diff --git a/challenge-101/paulo-custodio/basic/ch-2.bas b/challenge-101/paulo-custodio/basic/ch-2.bas index 30c62f9fb6..68b0ad627b 100644 --- a/challenge-101/paulo-custodio/basic/ch-2.bas +++ b/challenge-101/paulo-custodio/basic/ch-2.bas @@ -2,12 +2,12 @@ ' ' TASK #2 › Origin-containing Triangle ' Submitted by: Stuart Little -' You are given three points in the plane, as a list of six co-ordinates: +' You are given three points in the plane, as a list of six co-ordinates: ' A=(x1,y1), B=(x2,y2) and C=(x3,y3). -' -' Write a script to find out if the triangle formed by the given three +' +' Write a script to find out if the triangle formed by the given three ' co-ordinates contain origin (0,0). -' +' ' Print 1 if found otherwise 0. type Point |
