Skip to content

compute score and check output for Hash Code 2019 qualification round

License

Notifications You must be signed in to change notification settings

PicoJr/2019-hashcode-score

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hash Code 2019 Score Calculator

Codacy Badge

TL;DR Compute score and check output for Hash Code 2019 Qualification Round.

Usage

python3 score.py res/a_example.txt res/a_example.out

score: 2

Check Output File

use --check option.

check images id < maxid

./score.py res/a_example.txt res/a_example_error_id_max.out --check
INFO:root:parsing res/a_example.txt
INFO:root:parsing res/a_example.txt done
INFO:root:4 images found (2 V,2 H)
INFO:root:parsing res/a_example_error_id_max.out
ERROR:root:image id: 4 > max id: 3, at line: 2
INFO:root:parsing res/a_example_error_id_max.out: done
ERROR:root:invalid output file: res/a_example_error_id_max.out
score : 0

check images id occur at most once

./score.py res/a_example.txt res/a_example_error_same_id_twice.out --check
INFO:root:parsing res/a_example.txt
INFO:root:parsing res/a_example.txt done
INFO:root:4 images found (2 V,2 H)
INFO:root:parsing res/a_example_error_same_id_twice.out
ERROR:root:image id: 3 found again at line: 4
INFO:root:parsing res/a_example_error_same_id_twice.out: done
ERROR:root:invalid output file: res/a_example_error_same_id_twice.out
score : 0

check images orientation is valid

./score.py res/a_example.txt res/a_example_error_orientation.out --check
INFO:root:parsing res/a_example.txt
INFO:root:parsing res/a_example.txt done
INFO:root:4 images found (2 V,2 H)
INFO:root:parsing res/a_example_error_orientation.out
ERROR:root:image id: 0 (V expected: H) at line: 1
ERROR:root:image id: 3 (V expected: H) at line: 1
INFO:root:parsing res/a_example_error_orientation.out: done
ERROR:root:invalid output file: res/a_example_error_orientation.out
score : 0

Check And Abort On 1st Error

--check reports all errors.

use --abort option to abort on 1st error.

./score.py res/a_example.txt res/a_example_error_all.out --check --abort
INFO:root:parsing res/a_example.txt
INFO:root:parsing res/a_example.txt done
INFO:root:4 images found (2 V,2 H)
INFO:root:parsing res/a_example_error_all.out
ERROR:root:image id: 3 found again at line: 4
INFO:root:aborting...
INFO:root:parsing res/a_example_error_all.out: done
ERROR:root:invalid output file: res/a_example_error_all.out
score : 0

About

compute score and check output for Hash Code 2019 qualification round

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages