FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use simpler method for computing letter from number by livecodeali · Pull Request #3 · livecodeali/unspecified-livecode-project · GitHub

Use simpler method for computing letter from number - #3

Open
livecodeali wants to merge 1 commit into
travis-no-submodulefrom
travis-no-submodule-fail
Open

Use simpler method for computing letter from number#3
livecodeali wants to merge 1 commit into
travis-no-submodulefrom
travis-no-submodule-fail

Conversation

livecodeali commented May 10, 2019
edited
Loading

Copy link
Copy Markdown
Owner

Use a simpler method for computing the uppercase letter corresponding to a given number between 1 and 26

livecodeali force-pushed the travis-no-submodule branch from 9e8e55c to b009d0f Compare May 10, 2019 08:40
livecodeali force-pushed the travis-no-submodule-fail branch from 707b510 to 440b47a Compare May 10, 2019 08:45
function fromNumber pNum
local tNum
put ((pNum - 1) mod 26) + 65 into tNum
put (pNum mod 27) + 64 into tNum

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This does not wrap around correctly. For example shifting U by 6 will cause fromNumber(27) to be called, which gives 64, (@ in ascii).

Copy link
Copy Markdown
Owner Author

From the test log:

not ok - abjurer <-> nowhere (13)
# abjurer <-> nowhere (13) failed
# Expected result: nowhere
# Actual result: NOWGDRD

not ok - fusion <-> layout (6)
# fusion <-> layout (6) failed
# Expected result: layout
# Actual result: L@YOUT

not ok - manful <-> thumbs (7)
# manful <-> thumbs (7) failed
# Expected result: thumbs
# Actual result: THUMAS

Notice the letters that are shifted past Z and wrap around are all out by one.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL