Graphics Series #1: barcode EAN-13 part1
Description:
About barcode EAN-13

The EAN-13 barcode is used worldwide for marking products often sold at retail point of sale. I will not describe it in Kata in detail about it, because my poor English is certainly not better than Wikipedia. So, thanks to Wikipedia. Click here to view detailed information on barcode EAN-13.
Make sure you understand the rules, and then try to solve this kata ;-)
Rules of kata
First, in order to make your program easier, four data has been preload:
group ---- First group of 6 digits
group=["LLLLLL","LLGLGG","LLGGLG",
"LLGGGL","LGLLGG","LGGLLG",
"LGGGLL","LGLGLG","LGLGGL",
"LGGLGL"]
lcode ---- L-digits
lcode=["0001101","0011001","0010011",
"0111101","0100011","0110001",
"0101111","0111011","0110111",
"0001011"]
gcode ---- G-digits
gcode=["0100111","0110011","0011011",
"0100001","0011101","0111001",
"0000101","0010001","0001001",
"0010111"]
rcode ---- R-digits
rcode=["1110010","1100110","1101100",
"1000010","1011100","1001110",
"1010000","1000100","1001000",
"1110100"]
Hope that the data will help you solve this kata.
Second, your task is to write function readBarcode
, two arguments will be given: first
:the first digit; barcode
, given by a string, length=3+42+5+42+3=95, like this:
start 3 areas center 5 areas end 3 areas
| | |
"101...................01010..........................101"
| |
left 6 digit(6*7=42 areas) right 6 digit(6*7=42 areas)
Please according to the two arguments to decode it, return the digital value of the barcode (a string with 13 digits).
Graphics Series:
Similar Kata:
Stats:
Created | Jun 16, 2016 |
Published | Jun 17, 2016 |
Warriors Trained | 267 |
Total Skips | 43 |
Total Code Submissions | 458 |
Total Times Completed | 74 |
JavaScript Completions | 67 |
Python Completions | 10 |
Total Stars | 15 |
% of votes with a positive feedback rating | 97% of 36 |
Total "Very Satisfied" Votes | 34 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 6 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |