Code Monkey home page Code Monkey logo

Comments (11)

martinbra avatar martinbra commented on June 15, 2024

For showing the south hemisphere moon phases apparently it's only needed to rotate the moon drawing upside down and place the text accordingly.
So, I would like to propose 2 different steps:

  1. Prepare the upside down drawings (rotating the existing arrays with something as south=[a[::-1] for a in north[::-1]]) and add an optional command line argument -s --hemisphere [NORTH/SOUTH/AUTO] to show the moon upside down (auto to be implemented in step 2).
  2. Implement auto hemisphere detection by IP and/or localization as used in wttr.in/.

What are your thoughts on this?

from pyphoon.

dlangille avatar dlangille commented on June 15, 2024

That sounds good. Thank you.

from pyphoon.

martinbra avatar martinbra commented on June 15, 2024

oh, my mistake thinking it would only be needed to rotate the ascii art.
Look at the original and rotated moon:

             .---------.            
         .--'   o   .   `--.        
       .'@  @@@@@@    .   . `.      
     .'@@  @@@@@@@@  @@@@   . `.    
   .'    . @@@@@@@@ @@@@@@    . `.  
  / @@ o    @@@@@@.  @@@@    O   @\ 
  |@@@@              @@@@@@     @@| 
 / @@@@@   `.-.     @@@@@@@@  .  @@\ 
 |@ @@                @@@@@@ @@@   |
 \      @@    @   .()  @@   @@@@@  /
  |   @      @@@        @@@  @@@  | 
  \  .   @@  @\  .     .  @@    o / 
   `.   @@@@  _\ /    .      o  .'  
     `.  @@    ()--           .'    
       `.     / |      o    .'      
         `--./   .      .--'        
             `---------'           

rotated (look at the perimeter and the parentesis):

             '---------`
         '--.      .   /.--`
       '.    o      | /     .`
     '.           --)(    @@  .`
   '.  o      .    / \_  @@@@   .`
  / o    @@  .     .  \@  @@   .  \
  |  @@@  @@@        @@@      @   |
 /  @@@@@   @@  )(.   @    @@      \
 |   @@@ @@@@@@                @@ @|
 \@@  .  @@@@@@@@     .-.`   @@@@@ /
  |@@     @@@@@@              @@@@|
  \@   O    @@@@  .@@@@@@    o @@ /
   .` .    @@@@@@ @@@@@@@@ .    '.
     .` .   @@@@  @@@@@@@@  @@'.
       .` .   .    @@@@@@  @'.
         .--`   .   o   '--.
             .---------.

I will have to either swap some characters, like parentesis, or redo the ascii art.

I was thinking that keeping the art and making a swap table was better:

( --> )
) --> (
. --> `
` --> .
_ --> ^
' --> ,

which results in the following:

             ,---------.
         ,--`      `   /`--.
       ,`    o      | /     `.
     ,`           --()    @@  `.
   ,`  o      `    / \^  @@@@   `.
  / o    @@  `     `  \@  @@   `  \
  |  @@@  @@@        @@@      @   |
 /  @@@@@   @@  ()`   @    @@      \
 |   @@@ @@@@@@                @@ @|
 \@@  `  @@@@@@@@     `-`.   @@@@@ /
  |@@     @@@@@@              @@@@|
  \@   O    @@@@  `@@@@@@    o @@ /
   `. `    @@@@@@ @@@@@@@@ `    ,`
     `. `   @@@@  @@@@@@@@  @@,`
       `. `   `    @@@@@@  @,`
         `--.   `   o   ,--`
             `---------`

Which is not optimal, since some dots inside the moon have been replaced.

What are your thoughts on the matter?

from pyphoon.

dlangille avatar dlangille commented on June 15, 2024

My results are the same.

I started searching for flipping ascii art, but that was mostly table flipping. Next was: mirror ascii art

https://stackoverflow.com/questions/13112671/how-to-horizontally-mirror-ascii-art

from pyphoon.

martinbra avatar martinbra commented on June 15, 2024

Yeah, the issues are the same. Although rewriting every moon doesn't seen the smart thing to do, It's probably the best one can do to get a better outcome, to stay as faithful as possible to the original art.

What do you think @dlangille and @chubin ?

from pyphoon.

chubin avatar chubin commented on June 15, 2024

@martinbra

I think that your last drawing with fixes was pretty good, and we should use it.
And for other cases (e.g. other moon sizes), we should just make the automatic flipping.
This program is not just some moonphase viewer, it is a port of the original program developed in 197x, almost 50 years ago, and so we wouldn't like to diverge from it substantively. That being said, I think it is ok to add some new features, especially if they are isolated in a separate modules.

I thik that you original plan #1 (comment) was pretty good, so let's do it. Please:

  1. Make the changes
  2. Open a PR with them
  3. It will be merged

Then we try to bind it to wttr.in as you said.

I think this feature is very important, at least it is steadily being requested from time to time since years

from pyphoon.

chubin avatar chubin commented on June 15, 2024

#29 is merged now,

I've updated it on wttr.in, but it is not yet enabled in the wttr.in code

$ pyphoon -s south
                 ,	
             ,	
          ,	
       ,-	
      /	
    ,/	
   / 	
  / 	
  |	
 / 	 New Moon +
 | 	 0 21:17:30
 | 	 First Quarter -
 | 	 5 17:38:04
 \ 	
  |	
  \ 	
   \ 	
    `\	
      \	
       `-	
          `	
             `	
                 `

from pyphoon.

chubin avatar chubin commented on June 15, 2024

I think, this issue can be closed now, and we can move to wttr.in:
chubin/wttr.in#247

from pyphoon.

martinbra avatar martinbra commented on June 15, 2024

I think so. Thanks Chubin.

from pyphoon.

dlangille avatar dlangille commented on June 15, 2024

I am happy with any solution. :)

from pyphoon.

chubin avatar chubin commented on June 15, 2024

I've reopened the issue, because we want to add a note about the southern hemisphere in the output (chubin/wttr.in#247)

from pyphoon.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.