mirror of
https://github.com/bvanroll/advent_of_code_2022.git
synced 2025-08-28 19:22:39 +00:00
cleanup done
This commit is contained in:
9
day_2_part_2/Cargo.toml
Normal file
9
day_2_part_2/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "advent_of_code_2022"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rfd = "0.10.0"
|
74
day_2_part_2/src/main.rs
Normal file
74
day_2_part_2/src/main.rs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{BufRead, BufReader};
|
||||||
|
|
||||||
|
// struct play {
|
||||||
|
// them: str,
|
||||||
|
// you: str
|
||||||
|
// }
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
|
||||||
|
let current_path = std::env::current_dir().unwrap();
|
||||||
|
let res = rfd::FileDialog::new().set_directory(¤t_path).pick_file().unwrap();
|
||||||
|
let book = File::open(res.as_path()).unwrap();
|
||||||
|
|
||||||
|
|
||||||
|
let reader = BufReader::new(book);
|
||||||
|
let mut complete_score:i32 = 0;
|
||||||
|
|
||||||
|
let scores: HashMap<&str, i32> = HashMap::from([
|
||||||
|
("A", 1), //rock
|
||||||
|
("B", 2), //paper
|
||||||
|
("C", 3) //scizzors
|
||||||
|
]);
|
||||||
|
|
||||||
|
let lose_options: HashMap<i32,i32> = HashMap::from([
|
||||||
|
(1,3),//scissors lose to rock
|
||||||
|
(2,1),//rock lose to paper
|
||||||
|
(3,2)//paper lose to scissors
|
||||||
|
]);
|
||||||
|
|
||||||
|
let win_options: HashMap<i32,i32> = HashMap::from([
|
||||||
|
(1,2),//paper beats rock
|
||||||
|
(2,3),//scissors beat paper
|
||||||
|
(3,1)//rock beats scissors
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
for buffer in reader.lines() {
|
||||||
|
if let Ok(line) = buffer {
|
||||||
|
let unparsed_play = line.split(' ').collect::<Vec<&str>>();
|
||||||
|
complete_score += calculate_score(&unparsed_play, &scores, &lose_options, &win_options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("total score = {}", complete_score)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fn calculate_score(current_play: &Vec<&str>, scores: &HashMap<&str, i32>, lose_options: &HashMap<i32, i32>, win_options: &HashMap<i32, i32>) -> i32 {
|
||||||
|
let them:i32 = scores[current_play[0]];
|
||||||
|
let mut score = 0;
|
||||||
|
if (current_play[1] == String::from("X")) {
|
||||||
|
//lose
|
||||||
|
let mut score = (0 + lose_options[&them]);
|
||||||
|
println!("current play:\nthem: {}, \nus: {}\nscore: {}\nformula: gamestate {} + option {} = score {}", current_play[0],current_play[1], score, 0, lose_options[&them], score);
|
||||||
|
return score
|
||||||
|
} else if (current_play[1] == String::from("Y")) {
|
||||||
|
//draw
|
||||||
|
let mut score = 3 + them;
|
||||||
|
println!("current play:\nthem: {}, \nus: {}\nscore: {}\nformula: gamestate {} + option {} = score {}", current_play[0],current_play[1], score, 3, them, score);
|
||||||
|
return score;
|
||||||
|
} else {
|
||||||
|
//win
|
||||||
|
let mut score = 6 + win_options[&them];
|
||||||
|
println!("current play:\nthem: {}, \nus: {}\nscore: {}\nformula: gamestate {} + option {} = score {}", current_play[0],current_play[1], score,6,win_options[&them], score);
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
10
day_3/Cargo.toml
Normal file
10
day_3/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "advent_of_code_2022"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rfd = "0.10.0"
|
||||||
|
substring = "1.4.5"
|
300
day_3/input
Normal file
300
day_3/input
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
PcPlnShmrLmBnmcwBhrmcmbHNGFGpwdFFwGNjNbGqNHH
|
||||||
|
tzQfRJfWZZztWzVtCTfRzFZjpFjNZjGLHbdHLDdjpb
|
||||||
|
CCQTzRLzvQVVfRzJfMPsnBlglgPmBgPmvSrl
|
||||||
|
RMfvbbszHTsssFPzDQPggpQJPQ
|
||||||
|
NSNcqVtLVGgDlpQBClVB
|
||||||
|
hmStGNNLhjNrpWLGSjWrZssbZTMMvTfMnThbRRTs
|
||||||
|
fTrTPGTbfftWBBmLjrJL
|
||||||
|
DqHwVMqVplDslmlZmpHVwNnShWZFdBBdjWBtWtdtWJSSLS
|
||||||
|
MNslpDvVHlwsmpQRgQgCfTTcvcRQ
|
||||||
|
pBBhRgDsMsswprBhvgRglZtFGFFRqZtZmRtNqtZPPN
|
||||||
|
TdmmzzmdZdqdGFtF
|
||||||
|
nmSccCVmSCpDCswMwl
|
||||||
|
NptqDsQtDTQzCvlzCpRlRp
|
||||||
|
jmZcndmjbZcjrmDvFMFFlwCvzFnF
|
||||||
|
jjgLVLrGcdDBNhWQTgHg
|
||||||
|
mLVhhfSMSTmMwClHGdpjDHjGdV
|
||||||
|
zPrZgJCgbsnrPtZzsCsbpRDjBRHnjGDRldRHppcG
|
||||||
|
JJrbsFrZqrgWbbqbrgWzJPNTwhTNCmmvfWCShhhmwwfm
|
||||||
|
ftgfljvgfgBTNvtggFDDGLGRDnMDzcQzncGt
|
||||||
|
VdbpbVdZwdwrsVVLRrMrDLDBGnBGcM
|
||||||
|
wmpWwWsHWBCCCPPvjvmSqlfTTmSNgN
|
||||||
|
jSqmzmmSSDRjLMLDwqjNcMMLTTflffWCCsRsTHnHVrfHWTsr
|
||||||
|
tdbgZpgBPdgGZGGFTHVpCsCVfVsJpnWl
|
||||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||||
|
SmtQfgNmVFgVLVLVmrnMpcDLGCGLGDMpCp
|
||||||
|
CrdZdZmPPjrQdRPRDqDLBqBLBSWgWgLDzF
|
||||||
|
sQhTNphsVbhhhMJfhNVGqltVSzSllBzStlzFFFWB
|
||||||
|
hsMpwQhNMZmPmrwHRj
|
||||||
|
cNVpSVRpLHRLsVWWfnfsCshW
|
||||||
|
jvqjTgqZPlJZmbPPfbpswsPb
|
||||||
|
vlqdTZdtJvqdZjgqZrtRpQFtLFRQczHGzt
|
||||||
|
JJQndVQnQgTfNvGf
|
||||||
|
ljpbWbmNbDlGTvggGvZf
|
||||||
|
mpmRbMmmNDFDmScpzCsdzrnJrsCzrrnM
|
||||||
|
tNFtNFFzzjjzjBtVNZVbjZGlpSvTllpWwvnBlWGGBGCC
|
||||||
|
fPdcrrgPHrHMMMWlppGJSPwGSnGv
|
||||||
|
fmrqrhhfhdRddHrhQqQrfnLZjLtNttZjjRtzjFtRNj
|
||||||
|
sphRcpQRhfmnmfpptg
|
||||||
|
WVPlGLlSjCjSlGSHJJWZdmbmfvPmmnftbbgDdt
|
||||||
|
LJjjqVNjlnCTRcRhhsNcFF
|
||||||
|
vwwqttFjwgClRNCCvGNmZZMmJsPJjJpTdMpsZd
|
||||||
|
fBLVHHHrFnhHhnrVSTmfdPdPccTTPsMfsJ
|
||||||
|
QzVWzznzFbWNGNlt
|
||||||
|
vjMddVVmnWpdMndjvhhWfNLpfBsfLLZLBBSqqTZq
|
||||||
|
RFlrzQJPSRGzzzzgBZNsgBZTBflfgf
|
||||||
|
cQFDRHFDDGCJShCnvwVnnhCn
|
||||||
|
hgjlpRRLlPJJhTLJMDnwBndSPBNvMqnN
|
||||||
|
FGWVfZsmCbmVzrvtwCSMtMdnDMCw
|
||||||
|
VsVmVZfVQDmVFrrmzmGrHHTJgJjhHJcllglLQJRL
|
||||||
|
rrTVcTBgsjTffmfWHZTv
|
||||||
|
JLdnDlpGlGSLlpwJpHZfFvRZnWzWrHWqFH
|
||||||
|
wQDpDrdSlSCblCdwdSLlwQGBthPMsghNsVNVtCNNhNPjhs
|
||||||
|
CtCMvNhDMHfDDdffqtDtCflpJlBpvmWWJWwlpwFFvjwB
|
||||||
|
rGSbVGZrSsFJjlmBFZWp
|
||||||
|
rbbQgzVGrFVSPPGqfhftfqztNtqHtt
|
||||||
|
lMGZCGphllZDNshNNmHHND
|
||||||
|
PLwjVwJVsHmRrZZw
|
||||||
|
ffSdzjfZSjtjSjLtLLFFFGqFzznCpCnCBblQ
|
||||||
|
CqRnlzHCRWTlHPTZVQrcQtFsQFTcrQ
|
||||||
|
DfJcdBDBcftQjsrsBtjZ
|
||||||
|
JDfdGhSvNGhNfffGSfRznPvcRWcqCqmlvlcn
|
||||||
|
JPhBBBQCnCJCMhnhMZRrRZgbDgrWrNbglDgR
|
||||||
|
jLtSTwtsShwRNpRWrh
|
||||||
|
FLLSHsjGLGczvfPfJdfhddnHPC
|
||||||
|
BjHBNrWmTjFgJngbJhWd
|
||||||
|
vsGttMDtwCMQCJnqqqFJsggqdg
|
||||||
|
GFtDSwwMpTrzSSfcfm
|
||||||
|
rnWDQvpwWpDDcPjFPPHZjVDZ
|
||||||
|
CTJCRmCJcZZZHCCQ
|
||||||
|
LdlmdQJNpnLWbrfL
|
||||||
|
VdTdcVTZwCRGVGGMVmttlF
|
||||||
|
gnrsbngfgQSpBfpMBBBpSgMNNJbmGmlqGDqDNlFFJlGNFz
|
||||||
|
gprgQhgpMMMPsrRTCdPZwCwZZCRH
|
||||||
|
cHlCVGbbWHWqRNThhcNcmh
|
||||||
|
MwQDzpwdJwpBpPDQvrhShfLTTRLfLdjfNRqS
|
||||||
|
JwMBBrPsPDwQMDPPBPQJwMrvWHFbHHlgbsGnnWHnFnRGlblF
|
||||||
|
PQPjPDjRRQSFLSlgSmLlfh
|
||||||
|
zpLdBddbNCdqGbWJGWpJWWlsFsmmFpwfflFgfHwFhgmh
|
||||||
|
nJLdLVnzqqbjRctcPDQVTP
|
||||||
|
JdztScztPdSWLJLtgMbCjhvlbPRbjbMvCh
|
||||||
|
VZrqfQcFQwGVVFqfrTFTNqhljRHDMvMMGhRDRRHGbDhG
|
||||||
|
NZQNVQQpQmrZFQQFwQQVVZgBszJJgznstnmtcztdBSgs
|
||||||
|
nFHLNJzFbLJGGLMlTTRZbZRhWRTr
|
||||||
|
wVmgBBmtmwlqlWTwTM
|
||||||
|
sdvmgcPsCPPQQSMz
|
||||||
|
SccCqmQmgBmppLQmpSMjjlJzzsNPMDRbPNPlJM
|
||||||
|
VHZvwtZwhZHtdTwrVbNsljlRDlJPDhzsbN
|
||||||
|
dZwftVRftmcgpBCmBf
|
||||||
|
NTTlVlgNSflqbphFFhNbFp
|
||||||
|
wmmLmjwzwbWGLjRmtZZdhZLFtQQLQBFh
|
||||||
|
RvjbMjjvMzMWbDWwvzPjvmWSfVfsTlVVPVgTgPfVsnnnsJ
|
||||||
|
BsBsZHZNdWwsNdrzgCrMMqsjzzMC
|
||||||
|
flfhVWFmLrhQzCCh
|
||||||
|
fVbmFSpnSSmtnPZvdWbwvdvdHZ
|
||||||
|
NsZWWWWLsBZPhfsLmPhcFCCHCMMrqfqcvHMfHH
|
||||||
|
nThSllnplGlMpvFRcCqrrr
|
||||||
|
DnTwSztgzlDnVGTwztmdZhmLdJdNDshBdsWs
|
||||||
|
RBBGTFZGglMHvrtcgSdnNgjg
|
||||||
|
DmVcbmbJmwJDJzVVwzJfmfstnztvjnNjvNSpdptvzCnpjj
|
||||||
|
DsLcfLmbhVQssQJQscWRPBZZMMRLHFHZBGMG
|
||||||
|
FVvhVnhFnFhmvFhVcMBHLgcPClrqqrtqCppldrRRTppldg
|
||||||
|
QLWfDNwsQLtlrrCtDdpq
|
||||||
|
sJwZwLsGJWGGwzzWZNbWNLjQHSVhvHSnhcMFcbVmnvcchSBS
|
||||||
|
jTMNMrHBJWWDffRqfDBqfD
|
||||||
|
QmSFphtQqQmVmqVnPnPlpwgfnRnDPl
|
||||||
|
VqFmLFbLhmZhGFGmCmGtZ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qdNHJdtmcWdqdmtcm
|
||||||
|
bjbsBvjhSlVsPRgLQl
|
||||||
|
dDLbRdTMRJMbFRzZBfzNSjtNBzBD
|
||||||
|
PmgspqqVrppTVrvrsPhhfQwZBwNjNtNffzqqfwwN
|
||||||
|
mCcmsngrPvpVTssCVsvsPLRRJllGFlnRGbMJMWWlJJ
|
||||||
|
fGlGZHRRbwgPbZRRNCdcSWpncnQtQWlWcWpW
|
||||||
|
JrTLJgVvVLQQvtSvQncQ
|
||||||
|
JrrrmMTBVTmjBMrVjrshmJzgCfzRPCRZPGHfbwNPzbZHNH
|
||||||
|
qqqlDDZzVVnNqHDDFFFNlQpzjrTvsvzTbgJQQggjJp
|
||||||
|
cWPWcCmMfCMWdtPMhMbQQQjGGjpdvjTbjgjr
|
||||||
|
WtMSBCtCwchChMfBWtcPnNVNqZZLDRNqTRnnlwHn
|
||||||
|
mvQQnhBvhmvBmncmZBclTZTQccRFNFFdqFFgVqSRrgFrppNR
|
||||||
|
MjzJPzGPfffMCjVVjfPHLCFRNFStqrdRSdqdNGRqNptq
|
||||||
|
HDJHPjDJLfjbzfwPjCzCWWTwlmQhBnsWBvVsvBvZ
|
||||||
|
RVjcshhscQhrVjhvzjVfDNnzGtftmDHFttFGGf
|
||||||
|
qLcBCCMBJJbTdBDnNtdfnmDG
|
||||||
|
WpZgLLclTclRwgjgsrwsvj
|
||||||
|
shhhltNPcDtlNcNMcsctNtppLZvWWFLTFFZpTZDQgFLT
|
||||||
|
dRgJVzRHbqnLpTWQvLLJfp
|
||||||
|
mCVCdzqHndbqHCrVqRrmbwtNBsmPwNmScPgtPhBclw
|
||||||
|
bDDZMDrFPsrsMcsrbJZJdMMGpSzpSbwRSSRGpCHCGzlhCC
|
||||||
|
BWWNQjBLQVHhlGpSCmwj
|
||||||
|
ffwnNwfgtnNgVVwfNWBWnFsMJTJTcPFJcTFDsrJstJ
|
||||||
|
vQbQLQBpBvbvpHplHNTHWGZDngntZCQGgZhGhtjG
|
||||||
|
rqcc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||||||
|
gZgTccZGGpzdpjclGRVMVRFRMFvHRLRdLf
|
||||||
|
FMWMSBtStZqZWQtFtScWWSZmHPVJJVHwwlTgmgbzQwbwTJ
|
||||||
|
jhGLhdjNjsLvLsshzHJPVdVmmbzHzdHJ
|
||||||
|
jvDRNjnDNGRCzjLzZZpqnrFBSccWrMcB
|
||||||
|
zggmthDDghHvtrdgrVWfSBRwTHLWHwsBWw
|
||||||
|
PGGjpCjQnJQGJcJnnQpjFWVSsZWVLRZLBcsWSZBRWS
|
||||||
|
FGQlpnJCbqqGGRCjjnlCqGMtdNmmmvdNmmmzvhbrmgMz
|
||||||
|
TstvBTdgBhqTsdTcPlfCSrNMrNnrCNNSNNgp
|
||||||
|
HwLQwQDZzDjnDbmMhNSnmm
|
||||||
|
FZLVzLLQHRRzwWHjdPlJctlJtlsllhRs
|
||||||
|
fBtPsMDDswHvBmmVdBlSBRcGGnhVhg
|
||||||
|
LWJbrpFqpTLTTjqqNWlhnRGGSnhrcSdlRlsh
|
||||||
|
JWNbbpjJzTbNNNJNJMvmvfZHvzDsHDCsZw
|
||||||
|
LPGnPNLtwGhFFnJPfsqpVVszzpsP
|
||||||
|
TcWdvlrcWddggrDBDDdDMmWzRJqfVQZqmsfZsRQzZfZzQJ
|
||||||
|
TldWrMrDdlDCDdMTcwSLVCSShLNSwHjhGF
|
||||||
|
JGsWWWQsJmPwQWbBPmccbcbqFfMMpFDVCDFVFVCDqqfFwD
|
||||||
|
ZtLnlvLnNtvLndnCmfMVSmVCClfpVp
|
||||||
|
zTzZtjnZNLNmZvdtznntHHZJbBRGBRQWcJGbGsbsJRPQWT
|
||||||
|
MLmlMTPtQtMNlhbqbbqhflBB
|
||||||
|
rcrvjpSvScbRbBvbDBPG
|
||||||
|
ZZJzSHpzPrJzHFmMVMFmHCLNtV
|
43
day_3/src/main.rs
Normal file
43
day_3/src/main.rs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
use std::fs::File;
|
||||||
|
use std::io::{BufRead, BufReader};
|
||||||
|
use substring::Substring;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
//A = 65, Z = 90, a = 97, z = 122
|
||||||
|
let current_path = std::env::current_dir().unwrap();
|
||||||
|
let res = rfd::FileDialog::new().set_directory(¤t_path).pick_file().unwrap();
|
||||||
|
let list = File::open(res.as_path()).unwrap();
|
||||||
|
let reader = BufReader::new(list);
|
||||||
|
let mut counter :u64= 0;
|
||||||
|
for buffer in reader.lines() {
|
||||||
|
if let Ok(line) = buffer {
|
||||||
|
let first_half= line.substring(0,line.len()/2).as_bytes();
|
||||||
|
let second_half = line.substring(line.len()/2,line.len()).as_bytes();
|
||||||
|
for char in first_half {
|
||||||
|
if (second_half.contains(&char)) {
|
||||||
|
// println!("{}", (char % 91));
|
||||||
|
// println!("{}", char);
|
||||||
|
if ((char % 91) < *char) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let temp = u64::from(char.clone()) -96;
|
||||||
|
|
||||||
|
println!("{} is in both parts, LOWERCDASE", temp);
|
||||||
|
counter += temp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
let temp = u64::from(char.clone()) -38;
|
||||||
|
println!("{} is in both parts, UPPERCASE", temp);
|
||||||
|
counter += temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
println!("complete score is : {}", counter)
|
||||||
|
}
|
12
day_3_part_2/Cargo.toml
Normal file
12
day_3_part_2/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[package]
|
||||||
|
name = "advent_of_code_2022"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rfd = "0.10.0"
|
||||||
|
|
||||||
|
|
||||||
|
substring = "1.4.5"
|
300
day_3_part_2/input
Normal file
300
day_3_part_2/input
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
PcPlnShmrLmBnmcwBhrmcmbHNGFGpwdFFwGNjNbGqNHH
|
||||||
|
tzQfRJfWZZztWzVtCTfRzFZjpFjNZjGLHbdHLDdjpb
|
||||||
|
CCQTzRLzvQVVfRzJfMPsnBlglgPmBgPmvSrl
|
||||||
|
RMfvbbszHTsssFPzDQPggpQJPQ
|
||||||
|
NSNcqVtLVGgDlpQBClVB
|
||||||
|
hmStGNNLhjNrpWLGSjWrZssbZTMMvTfMnThbRRTs
|
||||||
|
fTrTPGTbfftWBBmLjrJL
|
||||||
|
DqHwVMqVplDslmlZmpHVwNnShWZFdBBdjWBtWtdtWJSSLS
|
||||||
|
MNslpDvVHlwsmpQRgQgCfTTcvcRQ
|
||||||
|
pBBhRgDsMsswprBhvgRglZtFGFFRqZtZmRtNqtZPPN
|
||||||
|
TdmmzzmdZdqdGFtF
|
||||||
|
nmSccCVmSCpDCswMwl
|
||||||
|
NptqDsQtDTQzCvlzCpRlRp
|
||||||
|
jmZcndmjbZcjrmDvFMFFlwCvzFnF
|
||||||
|
jjgLVLrGcdDBNhWQTgHg
|
||||||
|
mLVhhfSMSTmMwClHGdpjDHjGdV
|
||||||
|
zPrZgJCgbsnrPtZzsCsbpRDjBRHnjGDRldRHppcG
|
||||||
|
JJrbsFrZqrgWbbqbrgWzJPNTwhTNCmmvfWCShhhmwwfm
|
||||||
|
ftgfljvgfgBTNvtggFDDGLGRDnMDzcQzncGt
|
||||||
|
VdbpbVdZwdwrsVVLRrMrDLDBGnBGcM
|
||||||
|
wmpWwWsHWBCCCPPvjvmSqlfTTmSNgN
|
||||||
|
jSqmzmmSSDRjLMLDwqjNcMMLTTflffWCCsRsTHnHVrfHWTsr
|
||||||
|
tdbgZpgBPdgGZGGFTHVpCsCVfVsJpnWl
|
||||||
|
FnPQFvbvhFFFbvBwScjhzcqSLLSzSN
|
||||||
|
bWdgrWwwFWbgzFWzrmNbdPq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qDLBqBLBSWgWgLDzF
|
||||||
|
sQhTNphsVbhhhMJfhNVGqltVSzSllBzStlzFFFWB
|
||||||
|
hsMpwQhNMZmPmrwHRj
|
||||||
|
cNVpSVRpLHRLsVWWfnfsCshW
|
||||||
|
jvqjTgqZPlJZmbPPfbpswsPb
|
||||||
|
vlqdTZdtJvqdZjgqZrtRpQFtLFRQczHGzt
|
||||||
|
JJQndVQnQgTfNvGf
|
||||||
|
ljpbWbmNbDlGTvggGvZf
|
||||||
|
mpmRbMmmNDFDmScpzCsdzrnJrsCzrrnM
|
||||||
|
tNFtNFFzzjjzjBtVNZVbjZGlpSvTllpWwvnBlWGGBGCC
|
||||||
|
fPdcrrgPHrHMMMWlppGJSPwGSnGv
|
||||||
|
fmrqrhhfhdRddHrhQqQrfnLZjLtNttZjjRtzjFtRNj
|
||||||
|
sphRcpQRhfmnmfpptg
|
||||||
|
WVPlGLlSjCjSlGSHJJWZdmbmfvPmmnftbbgDdt
|
||||||
|
LJjjqVNjlnCTRcRhhsNcFF
|
||||||
|
vwwqttFjwgClRNCCvGNmZZMmJsPJjJpTdMpsZd
|
||||||
|
fBLVHHHrFnhHhnrVSTmfdPdPccTTPsMfsJ
|
||||||
|
QzVWzznzFbWNGNlt
|
||||||
|
vjMddVVmnWpdMndjvhhWfNLpfBsfLLZLBBSqqTZq
|
||||||
|
RFlrzQJPSRGzzzzgBZNsgBZTBflfgf
|
||||||
|
cQFDRHFDDGCJShCnvwVnnhCn
|
||||||
|
hgjlpRRLlPJJhTLJMDnwBndSPBNvMqnN
|
||||||
|
FGWVfZsmCbmVzrvtwCSMtMdnDMCw
|
||||||
|
VsVmVZfVQDmVFrrmzmGrHHTJgJjhHJcllglLQJRL
|
||||||
|
rrTVcTBgsjTffmfWHZTv
|
||||||
|
JLdnDlpGlGSLlpwJpHZfFvRZnWzWrHWqFH
|
||||||
|
wQDpDrdSlSCblCdwdSLlwQGBthPMsghNsVNVtCNNhNPjhs
|
||||||
|
CtCMvNhDMHfDDdffqtDtCflpJlBpvmWWJWwlpwFFvjwB
|
||||||
|
rGSbVGZrSsFJjlmBFZWp
|
||||||
|
rbbQgzVGrFVSPPGqfhftfqztNtqHtt
|
||||||
|
lMGZCGphllZDNshNNmHHND
|
||||||
|
PLwjVwJVsHmRrZZw
|
||||||
|
ffSdzjfZSjtjSjLtLLFFFGqFzznCpCnCBblQ
|
||||||
|
CqRnlzHCRWTlHPTZVQrcQtFsQFTcrQ
|
||||||
|
DfJcdBDBcftQjsrsBtjZ
|
||||||
|
JDfdGhSvNGhNfffGSfRznPvcRWcqCqmlvlcn
|
||||||
|
JPhBBBQCnCJCMhnhMZRrRZgbDgrWrNbglDgR
|
||||||
|
jLtSTwtsShwRNpRWrh
|
||||||
|
FLLSHsjGLGczvfPfJdfhddnHPC
|
||||||
|
BjHBNrWmTjFgJngbJhWd
|
||||||
|
vsGttMDtwCMQCJnqqqFJsggqdg
|
||||||
|
GFtDSwwMpTrzSSfcfm
|
||||||
|
rnWDQvpwWpDDcPjFPPHZjVDZ
|
||||||
|
CTJCRmCJcZZZHCCQ
|
||||||
|
LdlmdQJNpnLWbrfL
|
||||||
|
VdTdcVTZwCRGVGGMVmttlF
|
||||||
|
gnrsbngfgQSpBfpMBBBpSgMNNJbmGmlqGDqDNlFFJlGNFz
|
||||||
|
gprgQhgpMMMPsrRTCdPZwCwZZCRH
|
||||||
|
cHlCVGbbWHWqRNThhcNcmh
|
||||||
|
MwQDzpwdJwpBpPDQvrhShfLTTRLfLdjfNRqS
|
||||||
|
JwMBBrPsPDwQMDPPBPQJwMrvWHFbHHlgbsGnnWHnFnRGlblF
|
||||||
|
PQPjPDjRRQSFLSlgSmLlfh
|
||||||
|
zpLdBddbNCdqGbWJGWpJWWlsFsmmFpwfflFgfHwFhgmh
|
||||||
|
nJLdLVnzqqbjRctcPDQVTP
|
||||||
|
JdztScztPdSWLJLtgMbCjhvlbPRbjbMvCh
|
||||||
|
VZrqfQcFQwGVVFqfrTFTNqhljRHDMvMMGhRDRRHGbDhG
|
||||||
|
NZQNVQQpQmrZFQQFwQQVVZgBszJJgznstnmtcztdBSgs
|
||||||
|
nFHLNJzFbLJGGLMlTTRZbZRhWRTr
|
||||||
|
wVmgBBmtmwlqlWTwTM
|
||||||
|
sdvmgcPsCPPQQSMz
|
||||||
|
SccCqmQmgBmppLQmpSMjjlJzzsNPMDRbPNPlJM
|
||||||
|
VHZvwtZwhZHtdTwrVbNsljlRDlJPDhzsbN
|
||||||
|
dZwftVRftmcgpBCmBf
|
||||||
|
NTTlVlgNSflqbphFFhNbFp
|
||||||
|
wmmLmjwzwbWGLjRmtZZdhZLFtQQLQBFh
|
||||||
|
RvjbMjjvMzMWbDWwvzPjvmWSfVfsTlVVPVgTgPfVsnnnsJ
|
||||||
|
BsBsZHZNdWwsNdrzgCrMMqsjzzMC
|
||||||
|
flfhVWFmLrhQzCCh
|
||||||
|
fVbmFSpnSSmtnPZvdWbwvdvdHZ
|
||||||
|
NsZWWWWLsBZPhfsLmPhcFCCHCMMrqfqcvHMfHH
|
||||||
|
nThSllnplGlMpvFRcCqrrr
|
||||||
|
DnTwSztgzlDnVGTwztmdZhmLdJdNDshBdsWs
|
||||||
|
RBBGTFZGglMHvrtcgSdnNgjg
|
||||||
|
DmVcbmbJmwJDJzVVwzJfmfstnztvjnNjvNSpdptvzCnpjj
|
||||||
|
DsLcfLmbhVQssQJQscWRPBZZMMRLHFHZBGMG
|
||||||
|
FVvhVnhFnFhmvFhVcMBHLgcPClrqqrtqCppldrRRTppldg
|
||||||
|
QLWfDNwsQLtlrrCtDdpq
|
||||||
|
sJwZwLsGJWGGwzzWZNbWNLjQHSVhvHSnhcMFcbVmnvcchSBS
|
||||||
|
jTMNMrHBJWWDffRqfDBqfD
|
||||||
|
QmSFphtQqQmVmqVnPnPlpwgfnRnDPl
|
||||||
|
VqFmLFbLhmZhGFGmCmGtZLtJWzWHcJrNrHMccjMscMHzMZ
|
||||||
|
hGPGmbfPzbPfgdMdWGqBGQcqpp
|
||||||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lLPLVcVNCPDqVNdcqLdqtV
|
||||||
|
GnMGpslMhGsRzzHzGsZFZQJTTmWfBbvfgfgJRfbwbW
|
||||||
|
MRCtSwMhvjCGtvMZDVWpVZJlVccNDlpb
|
||||||
|
gdLQFFwwLfHJWnQlcJJbWc
|
||||||
|
rdqdmqHLTLmsswsFHLFtMPRMCSSRtSjTPMPSCR
|
||||||
|
jmCCnLCLZjZjRjQTLZQhGPGhhzHhDRGRDzwzwh
|
||||||
|
stlJlrlJJcSSfSMMzPfhhGhzpwhpNwhD
|
||||||
|
rbrbBcSlWmdZWjDnTm
|
||||||
|
PNBRNnnqQRNfVfRtVVzgFLLttpSwgzzzmFFF
|
||||||
|
fcWlcbvvCFzLbwLw
|
||||||
|
rlrMrhTJhDcTTfhRNqHRQPQRQNQB
|
||||||
|
TrprpprRVVfpRpVqTVpzDdvmvbbCchhcttqcthSMdd
|
||||||
|
JlnZnFlsMBZnJHlsLsCLbSNtbNhdbbShCScm
|
||||||
|
FlZjjsHHsnQFQwTDzMRRpGRR
|
||||||
|
wHWzwCTTqJhzzvJhWHWhqJWrFsFQrrrFCfFfgjjgjprfsp
|
||||||
|
DBRmZRtZLbnRBGSBmtGSLpjBrrsfrgsTQVrVrrPrgr
|
||||||
|
DLnbcbtLtmNNmbRcGbcGmHzlThNNhqJTHdvqvWlHJh
|
||||||
|
GSNqjRcqflNLnCTTWrWn
|
||||||
|
BmwQtmtJwPwmzMwQtHtVssvrnpWTTnsTTgpVCLCs
|
||||||
|
DBBQHJJrzhzQDDfSljRfhccfcdZf
|
||||||
|
wtgtChCwzqgLzjggqtHtjFHHFcnPfdRDfZZVcPfVZZfGnfdm
|
||||||
|
vBTrRTTWGGmcTDVD
|
||||||
|
SJMbbpWslJblSSNzNsztRChzqRCj
|
||||||
|
gBHHCtVCSHMQlfFTQqCfmq
|
||||||
|
WrpdwjbwbwQGlPqSqblP
|
||||||
|
wWDncWrDDNdWNRjScScjpzvHZtBMZtJsvLVgvzssBsvs
|
||||||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FRzZBfzNSjtNBzBD
|
||||||
|
PmgspqqVrppTVrvrsPhhfQwZBwNjNtNffzqqfwwN
|
||||||
|
mCcmsngrPvpVTssCVsvsPLRRJllGFlnRGbMJMWWlJJ
|
||||||
|
fGlGZHRRbwgPbZRRNCdcSWpncnQtQWlWcWpW
|
||||||
|
JrTLJgVvVLQQvtSvQncQ
|
||||||
|
JrrrmMTBVTmjBMrVjrshmJzgCfzRPCRZPGHfbwNPzbZHNH
|
||||||
|
qqqlDDZzVVnNqHDDFFFNlQpzjrTvsvzTbgJQQggjJp
|
||||||
|
cWPWcCmMfCMWdtPMhMbQQQjGGjpdvjTbjgjr
|
||||||
|
WtMSBCtCwchChMfBWtcPnNVNqZZLDRNqTRnnlwHn
|
||||||
|
mvQQnhBvhmvBmncmZBclTZTQccRFNFFdqFFgVqSRrgFrppNR
|
||||||
|
MjzJPzGPfffMCjVVjfPHLCFRNFStqrdRSdqdNGRqNptq
|
||||||
|
HDJHPjDJLfjbzfwPjCzCWWTwlmQhBnsWBvVsvBvZ
|
||||||
|
RVjcshhscQhrVjhvzjVfDNnzGtftmDHFttFGGf
|
||||||
|
qLcBCCMBJJbTdBDnNtdfnmDG
|
||||||
|
WpZgLLclTclRwgjgsrwsvj
|
||||||
|
shhhltNPcDtlNcNMcsctNtppLZvWWFLTFFZpTZDQgFLT
|
||||||
|
dRgJVzRHbqnLpTWQvLLJfp
|
||||||
|
mCVCdzqHndbqHCrVqRrmbwtNBsmPwNmScPgtPhBclw
|
||||||
|
bDDZMDrFPsrsMcsrbJZJdMMGpSzpSbwRSSRGpCHCGzlhCC
|
||||||
|
BWWNQjBLQVHhlGpSCmwj
|
||||||
|
ffwnNwfgtnNgVVwfNWBWnFsMJTJTcPFJcTFDsrJstJ
|
||||||
|
vQbQLQBpBvbvpHplHNTHWGZDngntZCQGgZhGhtjG
|
||||||
|
rqccPPmcrffRmsmCjVgnrGChChDjgW
|
||||||
|
fqRJsJMSlSzSWTbT
|
||||||
|
brsjjJPJw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WSZmHPVJJVHwwlTgmgbzQwbwTJ
|
||||||
|
jhGLhdjNjsLvLsshzHJPVdVmmbzHzdHJ
|
||||||
|
jvDRNjnDNGRCzjLzZZpqnrFBSccWrMcB
|
||||||
|
zggmthDDghHvtrdgrVWfSBRwTHLWHwsBWw
|
||||||
|
PGGjpCjQnJQGJcJnnQpjFWVSsZWVLRZLBcsWSZBRWS
|
||||||
|
FGQlpnJCbqqGGRCjjnlCqGMtdNmmmvdNmmmzvhbrmgMz
|
||||||
|
TstvBTdgBhqTsdTcPlfCSrNMrNnrCNNSNNgp
|
||||||
|
HwLQwQDZzDjnDbmMhNSnmm
|
||||||
|
FZLVzLLQHRRzwWHjdPlJctlJtlsllhRs
|
||||||
|
fBtPsMDDswHvBmmVdBlSBRcGGnhVhg
|
||||||
|
LWJbrpFqpTLTTjqqNWlhnRGGSnhrcSdlRlsh
|
||||||
|
JWNbbpjJzTbNNNJNJMvmvfZHvzDsHDCsZw
|
||||||
|
LPGnPNLtwGhFFnJPfsqpVVszzpsP
|
||||||
|
TcWdvlrcWddggrDBDDdDMmWzRJqfVQZqmsfZsRQzZfZzQJ
|
||||||
|
TldWrMrDdlDCDdMTcwSLVCSShLNSwHjhGF
|
||||||
|
JGsWWWQsJmPwQWbBPmccbcbqFfMMpFDVCDFVFVCDqqfFwD
|
||||||
|
ZtLnlvLnNtvLndnCmfMVSmVCClfpVp
|
||||||
|
zTzZtjnZNLNmZvdtznntHHZJbBRGBRQWcJGbGsbsJRPQWT
|
||||||
|
MLmlMTPtQtMNlhbqbbqhflBB
|
||||||
|
rcrvjpSvScbRbBvbDBPG
|
||||||
|
ZZJzSHpzPrJzHFmMVMFmHCLNtV
|
41
day_3_part_2/src/main.rs
Normal file
41
day_3_part_2/src/main.rs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
use std::fs::File;
|
||||||
|
use std::io::{BufRead, BufReader};
|
||||||
|
use substring::Substring;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut elfBuffer: Vec<String> = Vec::new();
|
||||||
|
let mut value: u64 = 0;
|
||||||
|
let current_path = std::env::current_dir().unwrap();
|
||||||
|
let res = rfd::FileDialog::new().set_directory(¤t_path).pick_file().unwrap();
|
||||||
|
let list = File::open(res.as_path()).unwrap();
|
||||||
|
let reader = BufReader::new(list);
|
||||||
|
for buffer in reader.lines() {
|
||||||
|
if let Ok(line) = buffer {
|
||||||
|
elfBuffer.push(line.clone());
|
||||||
|
if (elfBuffer.len() == 3) {
|
||||||
|
value += parse_elfs(elfBuffer[0].clone(), elfBuffer[1].clone(), elfBuffer[2].clone());
|
||||||
|
elfBuffer = Vec::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
println!("{}", value)
|
||||||
|
}
|
||||||
|
pub fn parse_elfs(elf_a: String, elf_b: String, elf_c: String) -> u64{
|
||||||
|
for char in elf_a.as_bytes() {
|
||||||
|
if elf_b.as_bytes().contains(char) && elf_c.as_bytes().contains(char) {
|
||||||
|
return convert_value(char.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;//nothing found
|
||||||
|
//TODO when nothing found make this throw an err and catch the err above
|
||||||
|
}
|
||||||
|
|
||||||
|
fn convert_value(value: u8) -> u64 {
|
||||||
|
if (value % 91) < value {
|
||||||
|
return u64::from(value.clone()) -96;
|
||||||
|
} else {
|
||||||
|
return u64::from(value.clone()) -38;
|
||||||
|
}
|
||||||
|
}
|
6
day_3_part_2/test.txt
Normal file
6
day_3_part_2/test.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
vJrwpWtwJgWrhcsFMMfFFhFp
|
||||||
|
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||||
|
PmmdzqPrVvPwwTWBwg
|
||||||
|
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||||
|
ttgJtRGJQctTZtZT
|
||||||
|
CrZsJsPPZsGzwwsLwLmpwMDw
|
Reference in New Issue
Block a user