Using part of the text file without reading whole one

I also want to generate and save random coordinates.

This file will contain:
board size(int) difficulty(string) some coordinates(2d array)

10 different board sizes,
3 difficulties and
20 levels,
Thats mean 600 different coordinate array i don’t want to read every one of that. Any suggestions?

I guess I have a solution but since i’m new to c# i don’t know exactly how to do it.
Create new class for management and new list to save and read data in a c# file.

(sorry for my english)

You can split then into groups. For example, create 1 file per board size. 10 files, only 60 per file. But you’ll probably find that reading 600 of them from disk takes a rather trivial amount of time to complete. So you might be overthinking this issue.

1 Like

Thanks for your answer.
Is there any way to do this partitioning inside the text file?

I thought the whole point was you didn’t want to put them all in the same file? How you’d partition it depends on what kind of text format you’re using. If it’s you’re own custom format, you’d just put some identifier to indicate the start of each partition. But I don’t think that would save you anything performance wise, since you’d need to read through the file to find the different partitions. Might as well just load the entire file at that point probably.

I changed my mind after reading this. I just wanted to know how to partition the file to make it easier to work on.

I will follow your advice, thank you.