Один из самых удобных способов записать данные это использование готовых форматов, такие как JSON или YAML.
Из плюсов такого подхода стоит отметить вот что:
🔸 готовый, повсеместно используемый и поддерживаемый формат
🔸 простой и понятный файл, удобочитаемый для человека
🔸 можно легко редактировать в любом текстовом редакторе без специальных программ и библиотек
Но есть и минусы
🔹 затраты времени при записи файла (кодирование данных в нужный формат строки)
🔹 затраты времени при чтении файла (декодирование данных в Python объекты)
🔹 размер файла увеличивается из-за разметки данных (скобки, запятые, переносы, отступы...)
🔹 перед записью все данные должны быть помещены в память в полном объёме (не всегда)
🔹 при чтении необходимо считать весь файл в память и только потом декодировать данные
Если нужно писать немного данных в несколько файлов, то затраты по времени не ощутимы. Обычно это файлы конфига или какие-либо метаданные. Это отличный вариант под такие задачи.
Есть и другой поход к записи файлов - это бинарные файлы. Используется, когда данных достаточно много и никто их не собирается читать глазками😳.
🔸 очень быстрая запись
🔸 чтение значительно быстрей чем JSON, YAML итд
🔸 размер файла значительно меньше, так как нет разметки
🔸 можно записывать данные по мере поступления не загружая всё в память
🔸 можно извлечь любую часть данных независимо
Из минусов
🔹 нужно определить свой формат записи данных (если не используете готовую спецификацию определённого формата)
🔹 не получится открыть файл и визуально понять что там записано, а для чтения файла потребуется знать его спецификацию.
🔹 не так-то просто создать такой файл без специальной библиотеки
В таком виде удобно записывать большой массив любых однородных данных. Например, мониторинг валютной биржи или кэшированная анимация 3D геометрии.
(Это не означает что нельзя записать данные разного типа, просто это будет не так удобно)
Представьте себе JPG-картинку. По сути это немного мета-информации и большой массив пикселей. Тоже самое со звуком или видео файлом. Поэтому, если вы попробуете открыть картинку в текстовом редакторе вы увидите что-то вроде такого
f15d cd29 a564 4578 ...
09e2 9bc4 a696 1253 ...
84e9 4de1 3b23 c24a ...
2534 5161 28e0 709d ...
...
Это и есть записанные байтики. И для их чтения требуется определённый софт который знает что с ними делать. Под каждый тип файла.
К чему это я? Читайте в следующем посте...
#tricks#basic
DAOLama x CapsGame: Launch of 'Follow the Lama' Season
#DAOLama#CapsGame
The DAOLama NFT Lending (@daolama) channel announces its collaboration with CapsGame for the launch of the 'Follow the Lama' season. Players can now use DIAMOND chips as collateral to gain liquidity on the DAOLama App. The new season features exclusive tasks, a leaderboard, and rewards that include converting lama points into tickets for valuable in-game items.
Source: link
@tonlines
👊Fatality Package is live
The arena burns with fire and lava – the atmosphere of an epic battle returns with the new ❤️CapsGame collection!
🔥 Total supply – 690,000 caps
🔥 Available in all packs: from Common to Legend
🔥 Each cap is a piece of the legendary universe, ready to become a weapon in your collection
Collect, trade, and fight – the collection is already waiting for you!
#CapsGame#TON#NFT#GameFi
🥴Whoaa! Chip utility is live, and farming has officially begun!
Astrologers have announced a month of major updates in #CapsGame. Did you think that chips were just for fun? No, they are not. Now chips can be sent to ❇️ staking and receive CapsGame tokens for them.
❤️$СG Token
🟣 The first phase of farming starts today and will last 10 weeks, during which we will distribute 5% of the total token supply.
🟣 Starting today, 30% of purchases will be sent to the liquidity pool at capsgame-liquidity.ton.
🟣 This is just the beginning, there will be a lot of news and updates in the game over the next 10 weeks. Don't miss out!
📝How does staking work?
Where the profile used to be, now lives a new beast called "Token". Let's figure out what that means:
➡️ You have 9 slots available for staking: 6 slots for chips of any collections, and 3 slots only for certain collections, which will change once a week, at 00:00 Moscow time on Wednesdays.
➡️ Each staked token generates a certain amount of tokens per hour (starting with EPIC).
➡️ The higher the grade and popularity of the feature, the higher the generation speed.
➡️ The higher the grade of the chip collection that is staked, the greater the bonus to the generation speed!
Still confused? Hit the wiki for the full breakdown
Game | Wiki | Chat | NFT collection
#CapsGame#TON#NFT#GameFi
Festival season with Ton Festival and CapsGame!
Our friends from ❤️CapsGame and
🔠TON Festival decided to join forces and launch a new season! A festive atmosphere, fresh activities, and, of course, a bunch of surprises — all this is already here!
What's ahead?
⚫️6 Cool Chips for Your Collection
⚫️ Huge edition — 20,000 chips
⚫️ Leaderboards and festival activities right in the game!
How to Earn you Tent Points 🏕
⚫️ Completing dailies: 10
⚫️ Mint of any chip: 50
⚫️ Chip Madness Round Completion: 5 (no repeats)
⚫️ Upgrade your chips to Legend+ and higher — the cooler the chip, the more points!
🏅Prize fund — tickets🎫 giving cool bonuses and exclusive items await those who collect the most points at the end of the season.
🗓️The final day of the event is March 27. The store opens on March 28th — exchange tickets for cool prizes!
🫶Become a part of the main event of the year!
#CapsGame#TONFest#Web3#TON
CapsGameon💎TON Community
The game was mentioned on the official TON channel, perhaps a hint that it is a future participant of the League.
CapsGame combines nostalgic gaming with innovative Web3 technologies, incentivizing active participation in the TON ecosystem through NFT trading. Players can earn rewards and profits from trading and upgrading their NFTs.
The game offers a PvP mode for those who like to take risks and bet their NFTs on the outcome of a battle with other players, as well as a safe PvE mode in which the player trains by playing with bots. CapsGame also encourages engagement and competition through rankings and quests.
And right now there is a new contest in BroBot together with #CapsGame in which you can get a unique SBT BroBot CapsGame and other prizes absolutely free.
☀️Complete tasks and get SBT!
#NFT#SBT#TON#BroBot
🛋Ease In, Get Cozy, Enjoy
❤️CapsGame has become even more cozy — the team has updated the main screen! Now the mini-app has become even more cozy and addictive. No more associations with clickers — maximum nostalgia for the OG game Chupa Caps, so launch the game and immerse yourself in the atmosphere of childhood.
Collect your favorite chips and turn valuable items into NFTs, which are already traded on #Getgems.
Game | Wiki | Chat | NFT collection
#CapsGame#TON#NFT#GameFi
💎CapsGame is launched! Caps are back from the 90s!
🧑💻CapsGame finished beta testing, fixed bugs and improved the app itself. Added in-game purchases for stars, plans to add support for payment in $TON and new activities based on the rating table
👌 The public release introduced a leaderboard that will be formed based on unique player collections. This means that each chip you collect will earn you points. By upgrading chips or completing collections, you will earn additional points. Each chip will be unique, with its own number, and collections will be strictly limited. More details.
🙂 For active participants of the beta test, special rewards were provided, which you can read about in this post.
Play in our Yard and start collecting rare chips, let's try to rise in the district rating together!😎
1️⃣Go to bot
2️⃣ Come into our yard
3️⃣ Play and win!
#CapsGame#TON#NFT#GameFi#ChildhoodComingBack