Last active
November 11, 2018 16:32
-
-
Save RQN/aaf72812b9929f25eb0ae1632dbbfbab to your computer and use it in GitHub Desktop.
ちろちろのパクり
This file contains 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
// using System.Collections.Generic; | |
public static class CharacterArt | |
{ | |
public static IEnumerable<Item> Diamond(int size) | |
{ | |
for (int i = 0; i < size; i++) | |
{ | |
yield return new Item | |
{ | |
Space = (size - i) - 1, | |
Symbol = (i + 1) * 2 - 1 | |
}; | |
} | |
for (int i = 0; i < size - 1; i++) | |
{ | |
yield return new Item | |
{ | |
Space = i + 1, | |
Symbol = (size - i) * 2 - 3 | |
}; | |
} | |
} | |
} |
This file contains 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
public class Item | |
{ | |
public int Space { get; set; } | |
public int Symbol { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment