8 changed files with 92 additions and 0 deletions
@ -0,0 +1,2 @@ |
|||||
|
/target/ |
||||
|
**/*.rs.bk |
||||
@ -0,0 +1,12 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="CargoProjects"> |
||||
|
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" /> |
||||
|
</component> |
||||
|
<component name="ProjectRootManager"> |
||||
|
<output url="file://$PROJECT_DIR$/out" /> |
||||
|
</component> |
||||
|
<component name="RustProjectSettings"> |
||||
|
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" /> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1,8 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="ProjectModuleManager"> |
||||
|
<modules> |
||||
|
<module fileurl="file://$PROJECT_DIR$/adventofcode2015.iml" filepath="$PROJECT_DIR$/adventofcode2015.iml" /> |
||||
|
</modules> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="VcsDirectoryMappings"> |
||||
|
<mapping directory="" vcs="Git" /> |
||||
|
</component> |
||||
|
</project> |
||||
@ -0,0 +1,4 @@ |
|||||
|
[[package]] |
||||
|
name = "adventofcode2015" |
||||
|
version = "0.1.0" |
||||
|
|
||||
@ -0,0 +1,6 @@ |
|||||
|
[package] |
||||
|
name = "adventofcode2015" |
||||
|
version = "0.1.0" |
||||
|
authors = ["Michael Preisach <michael@preisach.at>"] |
||||
|
|
||||
|
[dependencies] |
||||
@ -0,0 +1,15 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<module type="RUST_MODULE" version="4"> |
||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true"> |
||||
|
<exclude-output /> |
||||
|
<content url="file://$MODULE_DIR$"> |
||||
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> |
||||
|
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" /> |
||||
|
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" /> |
||||
|
<sourceFolder url="file://$MODULE_DIR$/benches" isTestSource="true" /> |
||||
|
<excludeFolder url="file://$MODULE_DIR$/target" /> |
||||
|
</content> |
||||
|
<orderEntry type="inheritedJdk" /> |
||||
|
<orderEntry type="sourceFolder" forTests="false" /> |
||||
|
</component> |
||||
|
</module> |
||||
@ -0,0 +1,39 @@ |
|||||
|
mod day1; |
||||
|
mod day2; |
||||
|
mod tests; |
||||
|
|
||||
|
|
||||
|
use std::fs::File; |
||||
|
use std::io::Read; |
||||
|
|
||||
|
fn main() { |
||||
|
match File::open("day1.txt") { |
||||
|
Ok(mut f) => { |
||||
|
let mut input = String::new(); |
||||
|
match f.read_to_string(&mut input) { |
||||
|
Ok(_) => (), |
||||
|
Err(msg) => println!("{}",msg), |
||||
|
} |
||||
|
let mut d1 = day1::Data::new(); |
||||
|
d1.parse(input); |
||||
|
println!("day1 floor: {}", d1.floor()); |
||||
|
println!("day1 basement: {}", d1.basement()); |
||||
|
} |
||||
|
Err(msg) => println!("{}",msg), |
||||
|
}; |
||||
|
|
||||
|
match File::open("day2.txt") { |
||||
|
Ok(mut f) => { |
||||
|
let mut input = String::new(); |
||||
|
match f.read_to_string(&mut input) { |
||||
|
Ok(_) => (), |
||||
|
Err(msg) => println!("{}",msg), |
||||
|
} |
||||
|
let mut d2 = day2::Data::new(); |
||||
|
d2.parse(input); |
||||
|
println!("day2 paper: {}", d2.paper()); |
||||
|
println!("day2 ribbon: {}", d2.ribbon()); |
||||
|
} |
||||
|
Err(msg) => println!("{}",msg), |
||||
|
}; |
||||
|
} |
||||
Loading…
Reference in new issue