data struct change to bit
eval() and construct table
fix off-by-1 bug