Skip to content

Instantly share code, notes, and snippets.

@RQN
Last active November 11, 2018 16:32
Show Gist options
  • Save RQN/aaf72812b9929f25eb0ae1632dbbfbab to your computer and use it in GitHub Desktop.
Save RQN/aaf72812b9929f25eb0ae1632dbbfbab to your computer and use it in GitHub Desktop.
ちろちろのパクり
// 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
};
}
}
}
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