~Eden
~Eden
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
var list = GeneratePoints(30);
var sqrt = (int)Math.Floor(Math.Sqrt(list.Count));

static List<int> GeneratePoints(int x)
{
List<int> points = [];

int increment = 360 / x;

// Loop from 0 to 360 with the increment
for (int i = 0; i < 360; i += increment)
points.Add(i);

return points;
}


list = list.Select((x, index) =>
{
double newIndex = ((index % sqrt) * sqrt) + ((double)index / sqrt);
return (x, newIndex);
})
.OrderBy(pair => pair.Item2)
.Select(pair => pair.Item1)
.ToList();



PrintList(list);


static void PrintList(List<int> list)
{

foreach (var item in list)
{
Console.Write(item + " " + "\n");
}
Console.WriteLine();
}
var list = GeneratePoints(30);
var sqrt = (int)Math.Floor(Math.Sqrt(list.Count));

static List<int> GeneratePoints(int x)
{
List<int> points = [];

int increment = 360 / x;

// Loop from 0 to 360 with the increment
for (int i = 0; i < 360; i += increment)
points.Add(i);

return points;
}


list = list.Select((x, index) =>
{
double newIndex = ((index % sqrt) * sqrt) + ((double)index / sqrt);
return (x, newIndex);
})
.OrderBy(pair => pair.Item2)
.Select(pair => pair.Item1)
.ToList();



PrintList(list);


static void PrintList(List<int> list)
{

foreach (var item in list)
{
Console.Write(item + " " + "\n");
}
Console.WriteLine();
}
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
oh nevermind its not sorting by MOST unique when it goes to bigger numbers ughhh but its accurate with its numbers 😉
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
int number = 10;
// Calculate the square root of the list count
var sqrt = (int)Math.Floor(Math.Sqrt(number));

// Project each pair into a new pair with the second item as the sorting key
List<int> sortedList = Enumerable.Range(1, number)
.Select((x, index) =>
{
double newIndex = ((index % sqrt) * sqrt) + ((double)index / sqrt);
return (x, newIndex);
})
// Sort the list by the second item of each pair
.OrderBy(pair => pair.Item2)
// Extract only the first item from each pair
.Select(pair => pair.Item1)
// Convert to a list
.ToList();
int number = 10;
// Calculate the square root of the list count
var sqrt = (int)Math.Floor(Math.Sqrt(number));

// Project each pair into a new pair with the second item as the sorting key
List<int> sortedList = Enumerable.Range(1, number)
.Select((x, index) =>
{
double newIndex = ((index % sqrt) * sqrt) + ((double)index / sqrt);
return (x, newIndex);
})
// Sort the list by the second item of each pair
.OrderBy(pair => pair.Item2)
// Extract only the first item from each pair
.Select(pair => pair.Item1)
// Convert to a list
.ToList();
Got a spiral sorter (ty chat gpt for the idea!) Now I just need to connect this to the number generator 😛
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
i want the most unique colors for all the points
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
its not symmetrical, but I dont want it to be
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
well in this case I would divide it by doing 0 24 48 72 96 120 1 4 2 5 3 6
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
my original code has it by segments which mislead you possibly I apologize!
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
i think its better to focus on the point count(amount of numbers) instead of categorizing it by segments
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
At this point, having these numbers close enough to the real values is perfectly fine. Just wanted to make that clear
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
This is getting really close! I think theres a calculation mistake though If I put n=10 I expect 30 numbers 360/30 = 12 The numbers should start at 0 and all numbers should be a multiple of 12 but im seeing numbers like 67.5 This is close enough for me though, i greatly appriciate the help youve given me 🙂
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
this still fails at n=5 i should be seeing 5 rows
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
i might be misunderstanding how to use your n
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
what does your n mean?
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
does that make sense?
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
i should be getting
0,120,240
60,180,300
30,150,270
90,210,330
15,135,255
0,120,240
60,180,300
30,150,270
90,210,330
15,135,255
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
instead I get
0,120,240
60,180,300
30,150,270
90,210,330
15,135,255
75,195,315
45,165,285
105,225,345
7.5,127.5,247.5
67.5,187.5,307.5
22.5,142.5,262.5
82.5,202.5,322.5
37.5,157.5,277.5
97.5,217.5,337.5
52.5,172.5,292.5
112.5,232.5,352.5
0,120,240
60,180,300
30,150,270
90,210,330
15,135,255
75,195,315
45,165,285
105,225,345
7.5,127.5,247.5
67.5,187.5,307.5
22.5,142.5,262.5
82.5,202.5,322.5
37.5,157.5,277.5
97.5,217.5,337.5
52.5,172.5,292.5
112.5,232.5,352.5
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
5 * 3c's meeaning 5 rows
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
i expect 15 numbers
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
not quite- when n=5
74 replies
CC#
Created by ~Eden on 1/30/2024 in #help
Splitting a number into equal distances (COMPLEX)
same with n=1 i expect the result to be
0,120,240
0,120,240
instead of
0,120,240
60,180,300
0,120,240
60,180,300
74 replies