# What changes do I need to make to my algorithm to make this scene from a different angle? [closed]

The code below is in F#. It creates a scene which looks like a perspective coming from the top left. I thought if I would change i % j = w then it would come from the top right instead, but that doesn't work. So what change do I need to make for it to be able to come from the top right, bottom left, bottom right and even the top centre?

open System

let w = Console.WindowWidth
let h = Console.WindowHeight

for i in 1 .. w - 1 do
for j in 1 .. h - 1 do
Console.SetCursorPosition(i, j)
if i % j = 0 then printf "."



Here is what the program looks like.

 .......................................................................................................................  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
.    .    .    .    .    .    .    .    .    .    .    .    .    .    .    .    .    .    .    .    .    .    .
.     .     .     .     .     .     .     .     .     .     .     .     .     .     .     .     .     .     .
.      .      .      .      .      .      .      .      .      .      .      .      .      .      .      .      .        .       .       .       .       .       .       .       .       .       .       .       .       .       .
.        .        .        .        .        .        .        .        .        .        .        .        .
.         .         .         .         .         .         .         .         .         .         .
.          .          .          .          .          .          .          .          .          .
.           .           .           .           .           .           .           .           .
.            .            .            .            .            .            .            .            .
.             .             .             .             .             .             .             .
.              .              .              .              .              .              .
.               .               .               .               .               .               .
.                .                .                .                .                .                .                  .                 .                 .                 .                 .                 .
.                  .                  .                  .                  .                  .
.                   .                   .                   .                   .
.                    .                    .                    .                    .
.                     .                     .                     .                     .
.                      .                      .                      .                      .
.                       .                       .                       .
.                        .                        .                        .
.                         .                         .                         .
.                          .                          .                          .
.                           .                           .                           .
.                            .                            .                            .


## closed as off-topic by Evil, David Richerby, Thomas Klimpel, Discrete lizard♦, Tom van der ZandenAug 31 '18 at 11:12

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question does not appear to be about computer science, within the scope defined in the help center." – Evil, David Richerby, Thomas Klimpel, Discrete lizard, Tom van der Zanden
If this question can be reworded to fit the rules in the help center, please edit the question.

• You've written "algorithm" but, really, this seems to be a programming problem, which is off-topic, here. Also, I'm not really sure what you're trying to achieve. – David Richerby Aug 20 '18 at 10:14
• @DavidRicherby Indeed, I had flagged this question as off-topic too although I answered it anyway. I just took a little bit more thought. I believe that the OP, as probably a newcomer to programming and computer science, may believe this question is about the correct algorithm that can produce the desired output. In a way, he is right. But then almost every programming problem can be treated as a question about algorithm. – Apass.Jack Aug 20 '18 at 10:38
• @Apass.Jack I agree that there's often no clear dividing line between designing an algorithm and writing a program. For me, this is on the programming side, though, as it's essentially "Here's a program that does X; how do I modify it to do Y?" But this is certainly something that reasonable people can disagree on. However, I would say that you shouldn't flag a question as off-topic and answer it: those are kind of contradictory acts. – David Richerby Aug 20 '18 at 10:49
Can you try replacing the original condition i % j == 0 with the following conditions? They work for me.
• For a perspective coming from the top right, (w-i) %j == 0
• For a perspective coming from the bottom left, i %(h-j) == 0
• For a perspective coming from the bottom right, (w-i) % (h-j) == 0
• For a perspective coming from the the top centre, (w/2-i) % j == 0