-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ana_rchy
committed
May 31, 2024
1 parent
385244a
commit 78895fb
Showing
3 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "leaderboard-recovery-tool" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
rmp-serde = "1.3.0" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use std::collections::HashMap; | ||
use std::io; | ||
use std::fs; | ||
use rmp_serde::encode; | ||
|
||
fn main() { | ||
let mut leaderboard = HashMap::<u64, u16>::new(); | ||
|
||
println!("enter entries in format [user_id],[count]"); | ||
loop { | ||
let mut input = String::new(); | ||
io::stdin().read_line(&mut input).expect("cant read input"); | ||
|
||
let mut params = input.split(","); | ||
let id = params.next().unwrap().parse::<u64>().unwrap(); | ||
let count = params.next().unwrap().parse::<u16>().unwrap(); | ||
leaderboard.insert(id, count); | ||
|
||
let leaderboard_bytes = encode::to_vec(&leaderboard).expect("couldnt serialize leaderboard"); | ||
_ = fs::write("leaderboard.bin", leaderboard_bytes); | ||
} | ||
} |