I have some data in a form of:
segs = [ '0000','0001','0002','0010','0011','0012','0100',..... '2222']
I know some of digits, for example '1...' or '..21' or '.1.0', etc., where dot represents unknown digit to fill. How to write a function F(segs, digit1, digit2, digit3, digit4) which can return all matching strings for given digits? If any digit is unknown, I can put empty string (or dot) instead, so:
F(segs,'','','','') should return full list
F(segs,1,0,0,2) should return one-element list only
F(segs,1,2,2,'') should return only ['1220','1221','1222']
Strings collected in segs represents some shapes and their orientations and I'd like to have rather a fast function, because it will be used in a game. This function will be invoked often, but no more than few times in a second.