Background Smoothing:
The purpose of Background Smoothing is to remove overall mottle or discolorations in the background of the scanned image typically resulting from scanning and/or paper non-uniformity. Background Smoothing improves overall appearance of the image and also results in higher file compression ratios. These results are achieved by “smoothing” up to three background colors (one neutral and two additional colors). Optionally one or more background colors may be smoothed to white.
Background smoothing is only available for Color/Grayscale output.
The type of background smoothing that is applied to the image is selected using ICAP_BACKGROUNDADJUSTMODE. Selecting TWBS_AUTOMATIC or TWBS_AUTOMATICBASIC will “smooth” up to three background colors. Selecting TWBS_CHANGETOWHITE will allow one or more background colors to be smoothed to white.
When the TWBS_CHANGETOWHITE adjustment mode is selected, ICAP_ BACKGROUNDADJUSTAPPLYTO becomes available. ICAP_ BACKGROUNDADJUSTAPPLYTO is used to select which background colors to smooth to white.
TWBA_ PREDOMINATE will smooth the predominate background color to white.
TWBA_NEUTRAL will smooth just the neutral color to white and also smooth the two additional background colors.
TWBA_ALL will smooth up to three background colors to white.
The aggressiveness of the background smoothing is selected using ICAP_BACKGROUNDADJUSTAGGRESSIVENESS. The more higher the value, the more likely a pixel will be determined to be background.
This is available when ICAP_BACKGROUNDADJUSTMODE is not set to TWBS_NONE or TWBS_AUTOMATICBASIC.
Blank Image Deletion:
This feature allows the user to instruct the driver to remove images that are considered blank. The driver can determine if an image is blank based on the content in the image or the final image size after any compression. The driver determines if it is blank on a per image basis. For example, if a Color and Black and White images are being created on the Front, it is possible that Front Color image will not be considered blank, but the Black and White image will be considered blank.
Blank image deletion, for a camera, can be turned on by setting CAP_BLANKPAGEMODE to TWBM_CONTENT (content based) or TWBM_COMPSIZE (final image size). It can be turned off by setting CAP_BLANKPAGEMODE to TWBM_NONE. However, blank page detection based on content is not available for all scanners.
When TWBM_CONTENT is selected, CAP_BLANKPAGECONTENT becomes available. CAP_BLANKPAGECONTENT is used to set the content percentage. If the image content is less or equal to the percent specified, the image will be deleted.
When TWBM_COMPSIZE is selected, CAP_BLANKPAGECOMPSIZEBW (Black and White image), CAP_BLANKPAGECOMPSIZEGRAY (Grayscale image) and CAP_BLANKPAGECOMPSIZERGB (Color image) are use to set the image size. If the final image size is less that the corresponding value, the image is deleted. For backward compatibility, the value CAP_BLANKPAGEMODE will be changed when any CAP_BLANKPAGECOMPSIZExxx is changed. If any value becomes non-zero, CAP_BLANKPAGEMODE will be set to TWBM_COMPSIZE. If all three values become zero, CAP_BLANKPAGEMODE well be set to TWBM_NONE.
Color Adjustments:
There are adjustments for Color/Grayscale outputs. These adjustments allow users to modify the overall Brightness, Contrast and Hue (red, green and blue) of their scanned documents; they are applied after the image has been color corrected. The user may also turn off color correction, including gamma correction (i.e. raw scanner image); the other adjustments are still applied.
All the possible adjustments are: Brightness, Contrast, Red, Green, Blue, and Raw. However, not all scanners support these.
Brightness and Contrast is controlled using ICAP_COLORBRIGHTNESSMODE.
TWCBR_NONE means no adjustment is made.
TWCBR_MANUAL means the user can adjust Brightness and Contrast (see ICAP_BRIGHTNESS and ICAP_CONTRAST).
TWCBR_AUTOMATICBASIC means the scanner will automatically adjust the image.
Brightness is controlled using ICAP_BRIGHTNESS. Increasing this will make documents appear to be lighter. This is ignored if ICAP_COLORBRIGHTNESSMODE is not set to TWCBR_MANUAL.
Contrast is controlled using ICAP_CONTRAST. Increasing this, for Color/Grayscale, will increase the image’s tonal range. This is ignored if ICAP_COLORBRIGHTNESSMODE is not set to TWCBR_MANUAL.
Color Balance is controlled using ICAP_COLORBALANCEMODE.
TWCBM_NONE means no adjustment is made.
TWCBM_MANUAL means the user can adjust Red, Green and Blue (see ICAP_COLORBALANCEREAD/GREEN/BLUE)
TWCBM_AUTOMATICBASIC means the scanner will automatically adjust the balance to be white.
TWCBM_AUTOMATIC is the same as TWCBM_AUTOMATICBASIC but the user can also adjust the aggressiveness of the balance (see ICAP_COLORBALANCEAUTOMATICAGRESSIVENESS)
The aggressiveness of the auto white is set using ICAP_COLORBALANCEAUTOMATICAGGRESSIVENESS. The higher the value, the more likely a pixel will be determined to be white.
Red, Green, and Blue are controlled using ICAP_COLORBALANCERED, ICAP_COLORBALANCEGREEN, and ICAP_COLORBALANCEBLUE; respectively. Increasing Blue, for example, will make the image appear bluer. This is ignored if ICAP_COLORBALANCEMODE is not set to TWCBM_MANUAL
Raw (i.e. no color/gamma correction) is controlled using ICAP_GAMMAENABLED.
Color Sharpening:
Apply ICAP_COLORSHARPEN to color and grayscale images: 0 indicates no sharpening. 1 is normal, 2 is more sharpening, and a value of 3 applies a lot of sharpening.
Document Type
If supported by the scanner, Document type indicates the type of content that is on the document. This is available for all outputs; however, for some scanners the selection needs to be the same for the Front and Back.
This is controlled using ICAP_DOCUMENTTYPE.
How to select the type:
------------------------------------------------------
If your documents contain a mix of text and business graphics (e.g. charts, graphs, etc), then select: TWDT_TEXTWITHGRAPHICS.
If your documents contain only text, then select: TWDT_TEXT.
If your documents contain mainly photographs, or you want the color correction optimized for photographs, then select: TWDT_PHOTO.
If, supported by the scanner and, your documents contain a mix of text and photographs, then select: TWDT_TEXTWITHPHOTO. If not supported, then TWDT_PHOTO or TWDT_TEXTWITHGRAPHICS is suggested.
NOTE: refer to the Color Table section of this guide for information on backward compatibility with color tables
Media Type
If supported by the scanner, Media type indicates the type of paper being scanned. This is available for all outputs; however, for some scanners the selection needs to be the same for the Front and Back.
This is controlled using ICAP_MEDIATYPE.
How to select the type:
------------------------------------------------------
If your documents are normal everyday paper (e.g. copier paper, inkjet paper, etc), then select: TWMT_PLAINPAPER.
If your documents are lightweight or thin (e.g. rice paper, ‘tissue’ paper, etc), then select: TWMT_THINPAPER.
If your documents are glossy (e.g. photographic paper), then select: TWMT_GLOSSYPAPER.
If your documents are magazine articles, then select: TWMT_MAGAZINE. If not supported, then TWMT_GLOSSYPAPER or TWMT_PLAINPAPER is suggested.
If your documents appear to be normal everyday paper but are thick (e.g. card stock), then select: TWMT_CARDSTOCK.
NOTE: unless otherwise specified, if the desired type is not supported by the scanner, then select TWMT_PLAINPAPER.
NOTE: refer to the Color Table section of this guide for information on backward compatibility with color tables
Color Tables
For scanners than now support Document Type (ICAP_DOCUMENTTYPE) and Media Type (ICAP_MEDIATYPE), Color Tables is only supported for backwards compatibility. That means selecting ICAP_COLORTABLE will still work, however it is highly recommend that code be setup to handle Document and Media Type.
For reference, the mapping between Color Tables and Document/Media Types is as follows:
--------------------------------------------------------------------------------------------
‘Mixed’ and ‘Text with Pictures’: TWDT_TEXTWITHGRAPHICS / TWMT_PLAINPAPER.
‘Photo’ and ‘Pictures’: TWDT_PHOTO / TWMT_GLOSSY.
‘Text’: TWDT_TEXT / TWMT_PLAINPAPER
Electronic Color Drop-Out (ECDO):
There are adjustments for Bitonal/Grayscale outputs. These adjustments allow users to select the ECDO color of their scanned documents.
The applications should only try to set the TWCD_FILE values. The DAT_ECDO operation for a way to map the display strings to the various ICAP_ECDO values.
ICAP_ECDOTREATASCOLOR allows you to indicate that a color other than black or dark blue ink was used for the data entered on the form. This not available on all scanner models or when ECDO is set to (none).
NOTE: refer to the ICAP_FILTERENUM section of this guide for information on backward compatibility with ECDO
Orthogonal Rotation:
This will rotate an image in 90 degree increments. The rotation occurs after
the image has been cropped and/or deskewed.
This is set using ICAP_ROTATION to indicate the number of degrees.
Some scanners support Automatic orthogonal rotation. When set, the driver will
automatically determine the degrees of rotation based on the content of the
image. This is turned on by setting ICAP_AUTOMATICROTATE to true.
ICAP_ORTHOGONALROTATE is a custom capability. It’s a combination of
ICAP_AUTOMATICROTATE and ICAP_ROTATION plus the TWOROT_AUTOMATIC_90 (or 180,
270). When ICAP_ORTHOGONALROTATE sets to TWOROT_AUTOMATIC_90 the driver uses
auto-orient algorithm automatically determine orthogonal rotation. However, if
the orientation cannot be determined, the image will be rotated 90 degrees.
For your reference, the following table shows the mapping between
ICAP_ORTHOGONALROTATE and ICAP_AUTOMATICROTATE and ICAP_ROTATION.
|
ICAP_ORTHOGONALROTATE |
ICAP_AUTOMATICROTATE |
ICAP_ROTATION |
|
TWOROT_NONE |
False |
0 |
|
TWOROT_90 |
False |
90 |
|
TWOROT_180 |
False |
180 |
|
TWOROT_270 |
False |
270 |
|
TWOROT_AUTOMATIC |
True |
0 |
|
TWOROT_AUTOMATIC_90 |
True |
0 |
|
TWOROT_AUTOMATIC_180 |
True |
0 |
|
TWOROT_AUTOMATIC_270 |
True |
0 |
Automatic Rotation:
If Automatic orthogonal rotation is supported (see Orthogonal Rotation) then
the TWAIN feature Automatic Rotate is also supported (ICAP_AUTOMATICROTATE).
If ICAP_AUTOMATICROTATE is set to true, then ICAP_ROTATION is set to 0
ICAP_AUTOMATICROTATE will automatically be updated anytime ICAP_ROTATION is
changed
Multifeed UDDS Sensors
The TWAIN driver provides the ability to detect a multifeed
condition by setting the CAP_ULTRASONICSENSITIVITY to TWUS_LOW, TWUS_MEDIUM or
TWUS_HIGH.
When CAP_ULTRASONICSENSITIVITY is not TWUSS_DISABLED, if supported, each sensor
(CAP_ULTRASONICSENSOR*) can be individually turned on (TWUO_ENABLED) or off
(TWUO_DISABLED). For scanners that support the “Ignore” feature,
TWUO_IGNOREZONE can also be selected.
NOTE: at least one sensor must remain on.
When TWUO_IGNOREZONE is selected, the height of the area to be ignored is
controlled by CAP_ULTRASONICSENSORZONEHEIGHT. This setting will apply to all
sensors set to TWUO_IGNOREZONE.
Multifeed Response:
The Multifeed Response is used to indicate what action to take when a multifeed is detected by the scanner. This value is only available when multifeed detection is turned on (i.e. CAP_ULTRASONICSENSITIVITY is not set to TWUSS_DISABLED, or CAP_PAGESIZELIMIT is not zero).
Going forward CAP_MULTIFEEDRESPONSE should be used instead of the values: CAP_DOUBLEFEEDSTOP and CAP_DOUBLEFEEDENDJOB. These values don’t allow access to all the possible multifeed responses, but are left in for backwards compatibility. All three values will automatically be updated, to stay in sync, when any of them are changed.
For your reference, the following table shows the mapping between CAP_MULTIFEEDRESPONSE and CAP_DOUBLEFEEDSTOP and CAP_DOUBLEFEEDENDJOB.
|
CAP_DOUBLEFEEDSTOP |
CAP_DOUBLEFEEDENDJOB |
CAP_MULTIFEEDRESPONSE |
|
True |
True |
TWMR_ENDOFJOB |
|
True |
True |
TWMR_ENDOFJOBLEAVEPAPER |
|
True |
False |
TWMR_STOPFEEDER |
|
False |
False |
TWMR_CONTINUE |
Image Edge Fill:
This feature fills the edges of the final electronic image
by covering the area with the specified color. Use ICAP_IMAGEEDGEFILL to
specify the color to fill with.
If scanner supported TWIE_AUTOMATIC and TWIE_AUTOMATICWITHTEAR the edge of an
image is automatically filled in with the same color space as the image.
When TWIE_AUTOMATIC or TWIE_AUTOMATICWITHTEAR is selected the ICAP_CROPPINGMODE is automatically changed to TWCR_AUTOMATICBORDERDETECTION and the ICAP_AUTOMATICDESKEW is also changed to TRUE.
If the current value of ICAP_IMAGEEDGEFILL is TWIE_AUTOMATIC
or TWIE_AUTOMATICWITHTEAR and ICAP_CROPPINGMODE is changed to not
TWCR_AUTOMATICBORDERDETECTION or ICAP_AUTOMATICDESKEW is changed to FALSE then
ICAP_IMAGEEDGEFILL is automatically changed to TWIE_NONE.
For the TWIE_WHITE and TWIE_BLACK, use ICAP_IMAGEEDGELEFT, ICAP_IMAGEEDGERIGHT,
ICAP_IMAGEEDGETOP and ICAP_IMAGEEDGEBOTTOM to specify the amount of fill for
each edge.
If you want all sides to be forced to have the same amount of fill, then set
ICAP_IMAGEEDGEFILLALLSIDES to True. The driver uses the value for the top edge
(ICAP_IMAGEEDGETOP) as the size of the fill for the other three edges. In
addition, the left (ICAP_ IMAGEEDGELEFT), right (ICAP_ IMAGEEDGERIGHT), and
bottom (ICAP_ IMAGEEDGEBOTTOM) edge will have read-only access since their
values are automatically set to match the top edge.
Sides Different:
The purpose of Sides Different allows the user to determine if Front and Rear values need to be the same or not.
When CAP_SIDESDIFFERENT is changed to False (i.e. transitioned from True to False), the driver will make the sides the same by copying all the Front camera settings to the Rear camera. While CAP_SIDESDIFFERENT is False, any value that is set on the current camera (e.g. Front) will automatically be set on the opposite camera (e.g. Rear).
When CAP_SIDESDIFFERENT is set to True, the driver would then allow different values for the Front and Rear camera. Realize that when CAP_SIDESDIFFERENT has a value of True, the values for Front and Rear may not actually be different. This would be the case when Sides Different is first set to True (i.e. transitioned from False to True), and no other values have been changed.
Device Events:
Applications can register for device events by issuing a CAP_DEVICEEVENT for events the driver wants to receive. For a list of supported events for each scanner model, refer to kdscust.h.
Applications are notified of device events via DG_CONTROL / DAT_NULL / MSG_DEVICEEVENT. Upon receiving a MSG_DEVICEEVENT, the application must immediately issue a DG_CONTROL / MSG_DEVICEEVENT / MSG_GET to obtain the event information.
TWDE_LAMPWARMUP
For version 9.3 drivers and up, the application can ask the driver to send this custom CAP_DEVICEEVENT if the lamps need to warmup prior to scanning. This event will be issued after a MSG_ENABLEDS if the lamps are not warmed up. The number of seconds before the lamps are ready will be in the TimeBeforeFirstCapture field of the TW_DEVICEVENT structure.
NOTE: The number of seconds may be longer than what it actually take. This could happen because an error occurred (e.g. opening cover, cancelling) or for models that do not have an accurate warmup value. Because of this, if your application is displaying a “please wait” message for the user, the message needs to be closed when MSG_XFERREADY is received.
Blank Image Deletion:
This feature allows the user to instruct the driver to remove images that are considered blank. The driver can determine if an image is blank based on the content in the image or the final image size after any compression. The driver determines if it is blank on a per image basis. For example, if a Color and Black and White images are being created on the Front, it is possible that Front Color image will not be considered blank, but the Black and White image will be considered blank.
Blank image deletion, for a camera, can be turned on by setting CAP_BLANKPAGEMODE to TWBM_CONTENT (content based) or TWBM_COMPSIZE (final image size). It can be turned off by setting CAP_BLANKPAGEMODE to TWBM_NONE. However, blank page detection based on content is not available for all scanners.
When TWBM_CONTENT is selected, CAP_BLANKPAGECONTENT becomes available. CAP_BLANKPAGECONTENT is used to set the content percentage. If the image content is less or equal to the percent specified, the image will be deleted.
When TWBM_COMPSIZE is selected, CAP_BLANKPAGECOMPSIZEBW (Black and White image), CAP_BLANKPAGECOMPSIZEGRAY (Grayscale image) and CAP_BLANKPAGECOMPSIZERGB (Color image) are use to set the image size. If the final image size is less that the corresponding value, the image is deleted. For backward compatibility, the value CAP_BLANKPAGEMODE will be changed when any CAP_BLANKPAGECOMPSIZExxx is changed. If any value becomes non-zero, CAP_BLANKPAGEMODE will be set to TWBM_COMPSIZE. If all three values become zero, CAP_BLANKPAGEMODE well be set to TWBM_NONE.
Getting Logs Programmatically:
This feature allows the user to retrieve logs. There are text based logs, XML based logs and EKLOG package files. A log is retrieved by issuing a DG_CONTROL/DAT_LOG/MSG_GET with a properly filled in TW_LOG structure. Fill in a TW_LOG structure with the desired log (LogType), the desired device (DeviceType), and the full path and name of the file (Filename) to store the log data into.
For all scanners, set DeviceType to TWDV_ADF to get the base scanners information. For those scanners that support the flatbed as an accessory (e.g. i1200, i1300, i1400), you will need to make a second call, with DeviceType set to TWDV_FLATBED, to get the flatbed’s information. This is necessary because the flatbed is a separate device.
DAT_LOG will return TWRC_FAILURE/TWCC_OPERATIONERROR if a request is made for a log that is not supported by the scanner (e.g. not all scanners have an operator log).
DAT_LOG will return TWRC_FAILURE/TWCC_BADVALUE if the DeviceType is TWDV_FLATBED and there is no separate flatbed scanner (e.g. i1000A4 & i1000A3) attached. Since this is the only case when this error code is returned, applications could make use of this by always issuing the second DAT_LOG call and let this be the way to know there is no separate flatbed scanner attached.
The text based logs are ones that can be easily viewed in something like Notepad, each log entry will be on its own line. These logs contain the same information as is shown on the driver UI on the Log tab. The language for the translated text will be based on the current language selected for the driver. The format of each log entry is not guaranteed, so you should never parse the entries to get information.
The XML based logs are designed to be flexible across scanners and to allow for future expansion. The following notes apply to the XML based logs:
The possible logs (LogType) are:
The XML format of the TWGL_GENERAL_XML log is as follows. Included are examples of what the tag values could be. The text to the right of the tags is a description of what the tag is (the numbers in parenthesis refer to the tag notes below. The descriptions will not appear in the log file:
<tw_log>
<cdname> KODAK i1210/i1220 Scanner</cdname> Family name from CD
<modelname>i1220</modelname> name of scanner model
<versioncd>1.25</versioncd> CD version
<versiontwain>9.64</versiontwain> TWAIN driver version
<versionui>3.23</versionui> TWAIN UI version
<flatbed>false</flatbed> flatbed attached (1)
<printer>false</printer> printer accessory available (1)
<background>black</background> front camera’s background color (2)
<backgroundrear>black</backgroundrear> rear camera’s background color (2)
<connection>USBSCAN 2.0</connection> interface scanner is connected to (3)
<serialnumber>1234567890</serialnumber> scanner’s serial number
<versionfirmware>1.43</versionfirmware> scanner firmware version
<versionhippo>4.5.1</versionhippo> image processing version
<versiondriver>2.3</versiondriver> driver.dll version
<versiondevice>2.10</versiondevice> device.dll version
<versiondevicemanager>1.1</versiondevicemanager> devicemanager.dll version
<meterpower>104</meterpower> time scanner has been on (4)
<metertransport>99</metertransport> time transport has been on (4)
<meterlampfront>104</meterlampfront> time front lamps have been on (4)
<meterlamprear>100</meterlamprear> time rear lamps have been on (4)
<meterfirstscan>2008/12/03 15:58:44.245</meterfirstscan> time & date of first scan (5)
<meterpagecount>5</meterpagecount> number of pages scanned
<multifeedcount>0</multifeedcount> # multifeeds seen (6)
<patchcountfront>0</patchcountfront> # patches seen on the front (6)
<patchcountrear>0</patchcountrear> # patches seen on the rear (6)
</tw_log>
Tag Notes:
Combine/Merge Front and Back Images:
This feature allows the user to instruct the driver to combine the front and back images from a document into a single image. This feature is designed for use with Duplex scanning from the document feeder, where there is one image per side and the front and back camera settings are the same. For example: CAP_DUPLEXENABLED set to True; Sides Different (CAP_SIDESDIFFERENT) is False; one camera per side has been enabled (i.e. just Color, or just Grayscale, or just Black and White).
This feature is only available for duplex scanner models. Even if this is turned on, the images will not be combined if more than one camera per side is enabled or the flatbed is scanned.
When this feature is on, the application will receive one image that contains both the front and the back of the page; instead of one image for the front and another image for the rear. If the final image has the original images one on top of the other (e.g. front on top of back), then the width of the final image will be based on the wider of the two original images. If the final image has the original images one to the left of the other (e.g. front to the left of the back), then the height of the final image will be based on the taller of the two original images. Any area that needs to be filled in (i.e. any padding of the narrower or shorter image) will be based on the color of the camera’s background. For example, if the camera’s background is black, then the image will be padded with black.
This feature can be turned on by setting CAP_IMAGEMERGE to a value other than TWIM_NONE. The valid choices are: TWIM_FRONTONTOP (front is on top of the back), TWIM_FRONTONBOTTOM (back is on top of front), TWIM_FRONTONLEFT (front is to the left of the back), and TWIM_FRONTONRIGHT (back is to the left of the front).
Feeder Mode
This allows you to select how the scanner transports documents through the scanner. This affects how the documents are fed into the scanner, how fast they move through the scanner, and how they are placed in the output tray.
The available enumerations for this capability, ICAP_FEEDERMODE, are different based on scanner and defined as follows:
· TWFM_NONE: No additional handling is performed. Best used when all documents are similar in size.
· TWFM_STACKINGIMPROVED: Aids in controlling how the documents are stacked/ordered in the output tray for mixed document sets. This should work for the majority of mixed sets.
· TWFM_STACKINGBEST: When your document set contains a great variability in size, this option provides the best control of how the documents are stacked/ordered within the output tray.
· TWFM_SPECIAL: For irregularly shaped documents (e.g., pages with coupons removed or documents with large holes or cutouts in them).
· TWFM_FRAGILE: For documents that need extra care as they are transported through the scanner and placed in the output tray.
· TWFM_THICK: For thick documents.
Controlled Dual Stacking Accessory
If you have the Controlled Dual Stacking Accessory installed, then you can separate documents into the two stacks of the Dual Stacking Accessory output tray. Separation of documents will be possible via any combination of document length, document content (toggle patch), and multifeed detection.
The first step is to turn on the feature by setting the following CAP:
· CAP_DUALSTACKINGENABLED - Set to TRUE to enable the Controlled Dual Stacking Accessory
Next, determine which stack of the output tray to place detected documents into by setting the following CAP.
· CAP_DUALSTACKINGSTACK - If CAP_DUALSTACKINGSTACK is set to TWDSS_STACK1, then documents that match any of the defined detection settings will be separated from the document set and placed in stack 1. All other documents will be placed in stack 2.
- If CAP_DUALSTACKINGSTACK is set to TWDSS_STACK2, then documents that match any of the defined detection settings will be separated from the document set and placed in stack 2. All other documents will be placed in stack 1.
Next, define the document detection criteria. Separation of documents will be possible via any combination of document length, document content (toggle patch), and multifeed detection.
If you would like to select which documents to separate from the document set based on the document's length, then you would set the following CAPs:
· CAP_DUALSTACKINGLENGTHMODE - Set to TWDSLM_LESSTHAN, TWDSLM_GREATERTHAN, or TWDSLM_BETWEEN
· CAP_DUALSTACKINGLENGTH1 - If CAP_DUALSTACKINGLENGTHMODE is set to TWDSLM_LESSTHAN, then any documents shorter than this length will be separated and placed in the selected CAP_DUALSTACKINGSTACK.
- If CAP_DUALSTACKINGLENGTHMODE is set to TWDSLM_GREATERTHAN, then any documents longer than this length will be separated and placed in the selected CAP_DUALSTACKINGSTACK.
- If CAP_DUALSTACKINGLENGTHMODE is set to TWDSLM_BETWEEN, then any documents whose length falls between CAP_DUALSTACKINGLENGTH1 and CAP_DUALSTACKINGLENGTH2 will be separated and placed in the selected CAP_DUALSTACKINGSTACK.
· CAP_DUALSTACKINGLENGTH2 - If CAP_DUALSTACKINGLENGTHMODE is "between", then any documents whose length falls between CAP_DUALSTACKINGLENGTH1 and CAP_DUALSTACKINGLENGTH2 will be separated and placed in the selected CAP_DUALSTACKINGSTACK.
If you would like to select which patch sheets, if any, to separate from the document set and place in the selected stack, then you would set the following CAPs:
· CAP_DUALSTACKINGPATCHTRANSFER - Set to TRUE will place Patch Type Transfer sheets in the selected CAP_DUALSTACKINGSTACK.
· CAP_DUALSTACKINGPATCHTYPE1 - Set to TRUE will place Patch Type 1 sheets in the selected CAP_DUALSTACKINGSTACK.
· CAP_DUALSTACKINGPATCHTYPE2 - Set to TRUE will place Patch Type 2 sheets in the selected CAP_DUALSTACKINGSTACK.
· CAP_DUALSTACKINGPATCHTYPE3 - Set to TRUE will place Patch Type 3 sheets in the selected CAP_DUALSTACKINGSTACK.
· CAP_DUALSTACKINGPATCHTYPE4 - Set to TRUE will place Patch Type 4 sheets in the selected CAP_DUALSTACKINGSTACK.
· CAP_DUALSTACKINGPATCHTYPE6 - Set to TRUE will place Patch Type 6 sheets in the selected CAP_DUALSTACKINGSTACK.
NOTE: You can select any combination of the above Patch Types.
If you would like to separate all documents that are determined to have been multifed, then you would set the following CAPs:
· CAP_DUALSTACKINGMULTIFEED - Set to TRUE will place documents that are determined to have been multifed in the selected CAP_DUALSTACKINGSTACK
Background
This will allow the user to select the color of the imaging background. This can be set differently per side.. The imaging background is what the scanner will see where there is no paper.
Use CAP_BACKGROUND to set the background color to white (i.e. TWBK_WHITE) or Black (i.e.TWBK_BLACK),
Examples of when the white background is useful are:
· Scanning non-rectangular documents and, in the final image, you want the area outside the document to be White instead of Black.
· Scanning lightweight or thin paper, with printing on one side, and you do not want the black background to bleed through the document and appear in the final image.
Physical Height Adjust
For scanners that support this setting, it is provided as a way to optimize throughput. It limits the maximum document length that the scanner can scan. So while the scanner is capable of scanning longer documents, it will not process any documents that are longer then this setting. Setting this to larger lengths may reduce the scanner’s throughput. For example, the scanner may be able to scan up to an 80 inch long document (i.e. the range maximum would be 80 inches), but if the default for this setting is 17 inches then the scanner will stop if something longer than 17 inches is scanned. To scan something longer than the default, this capability will need to be modified.
The range for this setting is determined by the scanner; therefore it should be read when connecting to the scanner. An example range is 2.5” to 3 meters.
When this capability, ICAP_PHYSICALHEIGHTADJUST, is modified the maximum paper size (i.e. ICAP_PHYSICALHEIGHT) will be impacted as well as any settings based on that (e.g. ICAP_SUPPORTEDSIZES, ICAP_FRAMES, CAP_PRINTERPOSITION, CAP_PAGESIZELIMIT). Therefore, it is recommended to re-read those values as appropriate.
NOTE: Some combinations of ICAP_PIXELTYPE and ICAP_XRESOLUTION may not be supported by the scanner when this capability is set to larger values. Instead of preventing these values from being set, and to allow for greater flexibility with applications, the scanner will not generate an error until it scans a document whose length is not supported.
OCP Buttons:
This feature allows the application to set the displayed text on the OCP for
each button. The driver may not remember this information. So we recommend that
the application should send the text after successfully MSG_OPENDS. The maximum
number of buttons that are allowed to be configured is 9.
To configure the number of buttons for the user to scroll through, the App must
send an array of TW_OCPBUTTONS structures which has the number of the buttons
defined plus an extra one that has Text field blank. For example, if the user
wants to setup the text for 3 buttons then define the array of 4 TW_OCPBUTTONS
structures. Set the Text for the first 3 items and set the Text to blank for
the 4th.
For the scanners that don’t have the ability to display the text, the
application still can configure the number of buttons for the user to scroll
through.
The order of the buttons displayed on the OCP is the same order of the buttons
defined in the array.
The Text is in the current language. The Ansi code
page which is based on the CAP_LANGUAGE is used for the conversion.
NumDataFields indicates how
many fields, after it and before Reserved, are filled in by the application.
PaperSource is used to
indicate which Paper Source the button will scan from. Set it to the desired
TWPU_* value. Refer to CAP_PAPERSOURCE for a list of TWPU_* values. For
example, if setting a button to "Color PDF" and the paper source is
"Document Feeder", then set:
Text = "Color PDF"
NumDataFields = 1
PaperSource = TWPU_ADF
NOTE: Not all scanners make use of PaperSource
The Reserved
field must be initialized to zero.
Hole Fill:
The Hole Fill feature is designed to remove “punch holes” in the original document from the resultant image. The output image is the same as the input image with the identified “holes” in the document image filled in with background. In the Bitonal case the background is white.
This feature can be turned on by setting ICAP_HOLEFILLENABLED to TRUE.
Streak Filter:
The Streak Filter Fill feature is designed to remove “streaks” in the original document from the resultant image. The amount of "aggressiveness" that the Streak Filter algorithm applies can be adjusted as needed.
This feature can be turned on by setting ICAP_STREAKREMOVALENABLED to TRUE.
The amount of aggressiveness can be adjusted by setting ICAP_STREAKREMOVALAGGRESSIVENESS to a value ranging from -2 to 2 in steps of 1; the default is 0. This value does not apply if ICAP_STREAKREMOVALENABLED is FALSE.
Cropping Mode:
This feature allows the user to specify how the scanner will detect document as it is being fed through the scanner.
The available enumerations for this capability, ICAP_CROPPINGMODE, are different based on scanner and defined as follows:
· TWCR_AUTOMATICBORDERDETECTION: The scanner will automatically find each document (regardless of size).
· TWCR_TRANSPORT: The scanner will return an image based on the area you specify in the ICAP_FRAMES or ICAP_FRAMESANGLE. It is suggested that you only use this option for scan jobs that contain same-sized documents.
· TWCR_DOCUMENT: The scanner will return an image based on the area you specify in the ICAP_FRAMES or ICAP_FRAMESANGLE which is relative to entire document.
· TWCR_AGGRESSIVEAUTOCROP: The scanner will automatically find each document and will straighten any document that may have been fed crooked. It’s also eliminating any residual border. Residual border can be caused by variations in a document edge; for example, when a document is not a perfect rectangle and/or was fed crooked.
· TWCR_CONTINUOUS: The scanner will split the document into separate images based on the area you specify with the ICAP_FRAMES or ICAP_FRAMESANGLE. It is suggested that you select an area that covers the entire width of the document and a height around 11 inches (297 mm).
· TWCR_PHOTO: The scanner will locate the photograph on the document and return an image that contains just the photograph. If the scanner finds more than one photograph on a document, one image is still returned which contains all photographs.
· TWCR_PHOTOINROI: The scanner will locate the photograph on the area you specify in the ICAP_FRAMES or ICAP_FRAMESANGLE and return an image that contains just the photograph. If the scanner finds more than one photograph on a specify area, one image is still returned which contains all photographs.
When TWIE_AUTOMATIC or TWIE_AUTOMATICWITHTEAR is selected from ICAP_IMAGEEDGEFILL the ICAP_CROPPINGMODE is automatically changed to TWCR_AUTOMATICBORDERDETECTION and the ICAP_AUTOMATICDESKEW is also changed to TRUE.
When the ICAP_CROPPINGMODE value is changed other capabilities are also changed. The following table shows the mapping between ICAP_CROPPINGMODE and ICAP_AUTOMATICDESKEW and ICAP_IMAGEEDGEFILL
|
ICAP_CROPPINGMODE |
ICAP_AUTOMATICDESKEW |
ICAP_IMAGEEDGEFILL (If current value is TWIE_AUTOMATIC or TWIE_AUTOMATICWITHTEAR) |
|
TWCR_AUTOMATICBORDERDETECTION |
TRUE |
No change |
|
TWCR_TRANSPORT |
FALSE |
TWIE_NONE |
|
TWCR_DOCUMENT |
TRUE |
TWIE_NONE |
|
TWCR_AGGRESSIVEAUTOCROP |
TRUE |
TWIE_NONE |
|
TWCR_CONTINUOUS |
FALSE |
TWIE_NONE |
|
TWCR_PHOTO |
TRUE |
TWIE_NONE |
|
TWCR_PHOTOINROI |
TRUE |
TWIE_NONE |
Foreground Boldness:
Use this option for documents or forms where you want the foreground (e.g. text, lines, etc.) to be more prominent.
Foreground Boldness is only available for Color/Grayscale output.
The available enumerations for this capability, ICAP_FOREGROUNDBOLDNESSMODE are defined as follows:
· TWFB_NONE: No Foreground Boldness is applied to the image.
TWFB_AUTOMATICBASIC: All foreground will be bolder.
TWFB_AUTOMATIC: For advanced users that want to further adjust the aggressiveness of the Foreground Boldness algorithm.
The aggressiveness of the Foreground Boldness algorithm is selected using ICAP_FOREGROUNDBOLDNESSAGGRESSIVENESS. The higher the value, the more boldness is applied to the image foreground. This is available only when ICAP_FOREGROUNDBOLDNESSMODE is set to TWFB_AUTOMATIC.


This puzzle contains many logic puzzles similar in spirit to the famous Cheryl’s Birthday problem. Each logic puzzle starts with Cheryl (in one case, Denise) giving Albert and Bernard partial information about some piece of data (e.g., her birthday, a set of numbers, a nonogram, etc.). Albert and Bernard then have a conversation about what they know and don’t know about the data. Based on this conversation, we can recover the original information given to Albert and Bernard by Cheryl, and more importantly, we can recover the values of the various italicized variables.
At the end of the puzzle, Cheryl tells Albert the first half of the answer to this puzzle and Bernard the second half of the answer to this puzzle. Albert and Bernard then have one final conversation about the answer to this puzzle, but where bits and pieces of their conversation are replaced with variables referencing earlier subpuzzles; for example, in Albert’s first line, Albert states “I don’t know if the answer contains exactly product vowels”. By solving the 8th subpuzzle, we can find that the value of product is 4, so Albert (at the beginning of the conversation) does not know if the answer contains exactly 4 vowels. Solving this final puzzle gives us the answer to the puzzle, BRUTES.
Below we provide full solutions to each of the subpuzzles and the final “meta” subpuzzle. Before we begin, some general tips that are useful across several of the subpuzzles:
This puzzle is actually isomorphic to the classic Cheryl’s birthday problem (i.e. it can be obtained from the classic Cheryl’s birthday problem by relabeling and reordering the months and the dates).
We can solve this puzzle as follows. Recall that the starting set of possible dates is given by the following table:
| May | 9 | 10 | ||||
|---|---|---|---|---|---|---|
| June | 8 | 11 | 12 | |||
| July | 11 | 12 | 13 | |||
| August | 8 | 10 |
Albert: I don't know when Cheryl's birthday is, but I know that Bernard doesn't know too.
No matter which month Cheryl’s birthday lies in, there is no way for Albert to know when Cheryl’s birthday is, so the first part of this statement gives us no information.
However, the second part of Albert’s statement (that he knows that Bernard does not know when Cheryl’s birthday is) does provide us with some information. If Bernard does not know when Cheryl’s birthday is, it must lie on a day that can possibly match with at least two different months. This immediately rules out the 9th and the 13th (which correspond uniquely to May and July respectively). Moreover, since Albert knows that Bernard doesn’t know when Cheryl’s birthday is, Cheryl’s birthday cannot belong to May or July.
We can therefore eliminate May 9, May 10, July 11, July 12, and July 13 as possible birthdays:
| May | 9 | 10 | ||||
|---|---|---|---|---|---|---|
| June | 8 | 11 | 12 | |||
| July | 11 | 12 | 13 | |||
| August | 8 | 10 |
Bernard: At first I didn't know when Cheryl's birthday is, but I know now.
Since Bernard now knows when Cheryl’s birthday is, it must now lie on a day which matches uniquely to a month. The only such days are the 10th, the 11th, and the 12th (which match with August, June, and June respectively). We can therefore eliminate June 8 and August 8:
| May | 9 | 10 | ||||
|---|---|---|---|---|---|---|
| June | 8 | 11 | 12 | |||
| July | 11 | 12 | 13 | |||
| August | 8 | 10 |
Albert: Then I also know when Cheryl's birthday is.
Since Albert knows when Cheryl’s birthday is, Albert’s month must contain only one possible date. Since June contains two possible dates (June 11 and June 12), Albert’s month must be August, and Cheryl’s birthday is August 10.
Answer: birthmonth = 8, birthday = 10
For reference, here is the 10-by-10 table Cheryl starts with:
| 30 | . | . | . | . | . | . | . | . | . |
| . | . | 40 | 4 | . | 33 | 22 | . | . | 16 |
| 35 | . | 3 | . | . | . | 32 | . | . | . |
| 17 | . | . | . | . | . | . | . | . | 18 |
| . | . | . | . | . | . | 11 | . | . | . |
| . | . | 14 | . | 31 | . | . | . | . | |
| . | 21 | . | . | . | . | . | . | 13 | . |
| . | . | . | . | 15 | . | . | . | . | . |
| . | . | . | . | . | 12 | . | 20 | 34 | . |
| . | . | 26 | . | 9 | . | . | . | . | 23 |
Albert: I don't know the location of the cell.
If Albert does not know the location of the cell, his row must contain at least two numbered squares. We can thus eliminate the first, fifth and eighth rows above (which only contain one numbered square) and obtain the following table:
| . | . | 40 | 4 | . | 33 | 22 | . | . | 16 |
| 35 | . | 3 | . | . | . | 32 | . | . | . |
| 17 | . | . | . | . | . | . | . | . | 18 |
| . | . | 14 | . | 31 | . | . | . | . | |
| . | 21 | . | . | . | . | . | . | 13 | . |
| . | . | . | . | . | 12 | . | 20 | 34 | . |
| . | . | 26 | . | 9 | . | . | . | . | 23 |
Bernard: I don't know the location of the cell.
Similarly, we can eliminate columns with a unique numbered square. This allows us to eliminate columns 2, 4 and 8 above.
| . | 40 | . | 33 | 22 | . | 16 |
| 35 | 3 | . | . | 32 | . | . |
| 17 | . | . | . | . | . | 18 |
| . | 14 | 31 | . | . | . | |
| . | . | . | . | . | 13 | . |
| . | . | . | 12 | . | 34 | . |
| . | 26 | 9 | . | . | . | 23 |
Albert: I don't know the location of the cell.
We again eliminate rows with a unique numbered square.
| . | 40 | . | 33 | 22 | . | 16 |
| 35 | 3 | . | . | 32 | . | . |
| 17 | . | . | . | . | . | 18 |
| . | 14 | 31 | . | . | . | |
| . | . | . | 12 | . | 34 | . |
| . | 26 | 9 | . | . | . | 23 |
Bernard: I don't know the location of the cell.
We again eliminate columns with a unique numbered square.
| . | 40 | . | 33 | 22 | 16 |
| 35 | 3 | . | . | 32 | . |
| 17 | . | . | . | . | 18 |
| . | 14 | 31 | . | . | |
| . | . | . | 12 | . | . |
| . | 26 | 9 | . | . | 23 |
Albert: We could continue this conversation indefinitely (by repeatedly saying "I don't know the location of the cell") without either of us learning the location of the cell.
We finally arrive at the core of this subpuzzle. To begin, let us understand what happens to this table if Albert and Bernard do continue this conversation indefinitely. If we do this, then we continue eliminating rows and columns from the table until we are left with a “stable” table, where the statement “I don’t know the location of the cell” conveys no additional information (regardless of who says it). If we carry out this procedure, we end up eliminating the rows and columns highlighted below in red before arriving at this stable state.
| . | 40 | . | 33 | 22 | 16 |
| 35 | 3 | . | 32 | . | |
| 17 | . | . | . | 18 | |
| . | 14 | 31 | . | . | |
| 12 | |||||
| . | 26 | 9 | . | 23 |
Note that the cells deleted in this process (the cells highlighted in red) are exactly the cells where Albert and Bernard would learn the location of the cell during this conversation (instead of eliminating the cell, at that point in the conversation one of Albert or Bernard would have to say that they do in fact know the location of the cell).
Now, how can Albert know for a fact that he and Bernard can continue the conversation indefinitely? Albert must know that the true cell is not deleted in this process. Since the cells deleted in this process belong to the first and fifth rows, we can delete these rows from the table.
| 35 | 3 | . | 32 | . |
| 17 | . | . | . | 18 |
| . | 14 | 31 | . | . |
| . | 26 | 9 | . | 23 |
Bernard: I know the location of the cell.
Bernard now knows the location of the cell. That must mean that Bernard’s column contains a unique numbered cell. The only such column is the fourth column in the above table, which contains the cell numbered 32.
Answer: cell = 32
Since there are 6 possibilities for each of d1, d2, and d3, there are 216 possibilities for the numbers given to Albert, Bernard and Cheryl. While it’s possible to solve this puzzle by keeping track of all 216 possibilities in a 6-by-6-by-6 table, we will take a different approach (which will greatly reduce the set of possibilities we need to consider).
Let A, B, and C equal d2 + d3, d1 + d3, and d1 + d2 respectively.
Cheryl: I don't know if there are exactly two 1s among Denise's three numbers.
Note that if Cheryl’s number is larger than 7, it is impossible for either d1 or d2 to be equal to 1, so it is impossible for two of Denise’s three numbers to equal 1. We therefore know that C is less than or equal to 7. (It is also easy to check that any number between 2 and 7 is possible for C, but we will not need this).
Bernard: I don't know if there are exactly zero 1s among Denise's three numbers.
Note that if Bernard’s number B was 2 or 3, then that would guarantee at least one 1 among the numbers d1 and d3. It follows that B cannot be 2 or 3.
Interestingly, B cannot be 12 either. Note that if Bernard’s number is 12, d1 and d3 must both be 6. Then, if d2 > 1, we would have that C = d1 + d2 > 7, contradicting what we know from Cheryl’s first statement.
Any other value for B is possible. If 4 ≤ B ≤ 8, then (d1 , d2 , d3) = (3, 1, B−3) is one possible assignment where there is at least one 1, and (d1 , d2 , d3) = (2, 2, B−2) is a possible assignment where there are no 1’s. Similarly, if 9 ≤ B ≤ 11, (d1 , d2 , d3) = (5, 1, B−5) is one possible assignment where there is at least one 1, and (d1 , d2 , d3) = (5, 2, B−5) is a possible assignment where there are no 1’s.
Cheryl: I don't know if there are exactly two 6s among Denise's three numbers.
Similarly as in the first step, this implies that C ≥ 7 (since if C < 7, neither d1 nor d2 can be 6).
But now we know both that C ≤ 7 and C ≥ 7, so we must have that C = 7. It follows that d2 = 7 − d1, so we can parametrize the triple (d1, d2, d3) via just the value of d1 and d3. We do so in the following table, where the row corresponds to the value of d1 and the column corresponds to the value of d3.
| (1, 6, 1) | (2, 5, 1) | (3, 4, 1) | (4, 3, 1) | (5, 2, 1) | (6, 1, 1) |
| (1, 6, 2) | (2, 5, 2) | (3, 4, 2) | (4, 3, 2) | (5, 2, 2) | (6, 1, 2) |
| (1, 6, 3) | (2, 5, 3) | (3, 4, 3) | (4, 3, 3) | (5, 2, 3) | (6, 1, 3) |
| (1, 6, 4) | (2, 5, 4) | (3, 4, 4) | (4, 3, 4) | (5, 2, 4) | (6, 1, 4) |
| (1, 6, 5) | (2, 5, 5) | (3, 4, 5) | (4, 3, 5) | (5, 2, 5) | (6, 1, 5) |
| (1, 6, 6) | (2, 5, 6) | (3, 4, 6) | (4, 3, 6) | (5, 2, 6) | (6, 1, 6) |
We have highlighted in red the cells where B = 2, 3, or 12 (and are thus invalid). One nice feature of this table is that along the diagonals running from south-west to north-east, Bernard’s value is fixed, and along the anti-diagonals running from north-west to south-east, Albert’s value is fixed.
Albert: I don't know if there are exactly zero 6s among Denise's three numbers.
It suffices to check which anti-diagonals both contain a valid cell with zero 6s and a valid cell with at least one 6 — we can eliminate all other anti-diagonals in the above table. In particular, we can eliminate the anti-diagonals with A = 2, 7, 11, and 12.
| (1, 6, 1) | (2, 5, 1) | (3, 4, 1) | (4, 3, 1) | (5, 2, 1) | (6, 1, 1) |
| (1, 6, 2) | (2, 5, 2) | (3, 4, 2) | (4, 3, 2) | (5, 2, 2) | (6, 1, 2) |
| (1, 6, 3) | (2, 5, 3) | (3, 4, 3) | (4, 3, 3) | (5, 2, 3) | (6, 1, 3) |
| (1, 6, 4) | (2, 5, 4) | (3, 4, 4) | (4, 3, 4) | (5, 2, 4) | (6, 1, 4) |
| (1, 6, 5) | (2, 5, 5) | (3, 4, 5) | (4, 3, 5) | (5, 2, 5) | (6, 1, 5) |
| (1, 6, 6) | (2, 5, 6) | (3, 4, 6) | (4, 3, 6) | (5, 2, 6) | (6, 1, 6) |
Bernard: I don't know if there is exactly one 1 among Denise's three numbers.
Similarly, we check which diagonals both contain a valid cell with exactly one 1, and a valid cell with zero or two 1s. This allows us to eliminate the cells with B = 4 and 7.
| (1, 6, 1) | (2, 5, 1) | (3, 4, 1) | (4, 3, 1) | (5, 2, 1) | (6, 1, 1) |
| (1, 6, 2) | (2, 5, 2) | (3, 4, 2) | (4, 3, 2) | (5, 2, 2) | (6, 1, 2) |
| (1, 6, 3) | (2, 5, 3) | (3, 4, 3) | (4, 3, 3) | (5, 2, 3) | (6, 1, 3) |
| (1, 6, 4) | (2, 5, 4) | (3, 4, 4) | (4, 3, 4) | (5, 2, 4) | (6, 1, 4) |
| (1, 6, 5) | (2, 5, 5) | (3, 4, 5) | (4, 3, 5) | (5, 2, 5) | (6, 1, 5) |
| (1, 6, 6) | (2, 5, 6) | (3, 4, 6) | (4, 3, 6) | (5, 2, 6) | (6, 1, 6) |
Albert: I don't know if there is exactly one 6 among Denise's three numbers.
Again, we check for anti-diagonals which contain a valid cell with exactly one 6, and a valid cell with zero or two 6s. This allows us to eliminate the cells with A = 10.
| (1, 6, 1) | (2, 5, 1) | (3, 4, 1) | (4, 3, 1) | (5, 2, 1) | (6, 1, 1) |
| (1, 6, 2) | (2, 5, 2) | (3, 4, 2) | (4, 3, 2) | (5, 2, 2) | (6, 1, 2) |
| (1, 6, 3) | (2, 5, 3) | (3, 4, 3) | (4, 3, 3) | (5, 2, 3) | (6, 1, 3) |
| (1, 6, 4) | (2, 5, 4) | (3, 4, 4) | (4, 3, 4) | (5, 2, 4) | (6, 1, 4) |
| (1, 6, 5) | (2, 5, 5) | (3, 4, 5) | (4, 3, 5) | (5, 2, 5) | (6, 1, 5) |
| (1, 6, 6) | (2, 5, 6) | (3, 4, 6) | (4, 3, 6) | (5, 2, 6) | (6, 1, 6) |
Bernard: The number I was given is even.
We can eliminate all diagonals with an odd sum. In particular, we eliminate the remaining cells with B = 5, 9, and 11.
| (1, 6, 1) | (2, 5, 1) | (3, 4, 1) | (4, 3, 1) | (5, 2, 1) | (6, 1, 1) |
| (1, 6, 2) | (2, 5, 2) | (3, 4, 2) | (4, 3, 2) | (5, 2, 2) | (6, 1, 2) |
| (1, 6, 3) | (2, 5, 3) | (3, 4, 3) | (4, 3, 3) | (5, 2, 3) | (6, 1, 3) |
| (1, 6, 4) | (2, 5, 4) | (3, 4, 4) | (4, 3, 4) | (5, 2, 4) | (6, 1, 4) |
| (1, 6, 5) | (2, 5, 5) | (3, 4, 5) | (4, 3, 5) | (5, 2, 5) | (6, 1, 5) |
| (1, 6, 6) | (2, 5, 6) | (3, 4, 6) | (4, 3, 6) | (5, 2, 6) | (6, 1, 6) |
Albert: The number I was given is prime.
We can eliminate all non-prime anti-diagonals. In particular, we eliminate the remaining cells with A = 9.
| (1, 6, 1) | (2, 5, 1) | (3, 4, 1) | (4, 3, 1) | (5, 2, 1) | (6, 1, 1) |
| (1, 6, 2) | (2, 5, 2) | (3, 4, 2) | (4, 3, 2) | (5, 2, 2) | (6, 1, 2) |
| (1, 6, 3) | (2, 5, 3) | (3, 4, 3) | (4, 3, 3) | (5, 2, 3) | (6, 1, 3) |
| (1, 6, 4) | (2, 5, 4) | (3, 4, 4) | (4, 3, 4) | (5, 2, 4) | (6, 1, 4) |
| (1, 6, 5) | (2, 5, 5) | (3, 4, 5) | (4, 3, 5) | (5, 2, 5) | (6, 1, 5) |
| (1, 6, 6) | (2, 5, 6) | (3, 4, 6) | (4, 3, 6) | (5, 2, 6) | (6, 1, 6) |
Bernard: I now know Denise's three numbers.
In order for Bernard to know Denise’s three numbers, there must be a unique cell on the diagonal corresponding to Bernard’s number. There is only one choice of diagonal with a unique cell, and that is the diagonal with B = 10. It follows that (d1, d2, d3) = (6, 1, 4), the label of this unique cell.
Answer: d1 = 6, d2 = 1, d3 = 4.
The possibilities for Albert’s number (div1) and Bernard’s number (div2) can be summarized in the following table of (div1, div2) pairs:
| (1, 2) | (1, 3) | (1, 4) | (1, 5) | (1, 6) | (1, 7) | |
| (2, 4) | (2, 6) | |||||
| (3, 6) | ||||||
Albert: Bernard doesn't know my number.
If div2 is prime, then Bernard knows that Albert’s number must be 1. On the other hand, if div2 is composite, then Bernard does not know Albert’s number (for example, it can be either 1 or the smallest prime divisor of Bernard’s number). Therefore, if Bernard doesn’t know Albert’s number, div2 is composite.
If Albert knows that Bernard doesn’t know Albert’s number, then Albert must know that Bernard’s number is composite. For the numbers in this table, this is possible if and only if div1 = 2 or 3; we can thus eliminate all cells with div1 = 1:
| (1, 2) | (1, 3) | (1, 4) | (1, 5) | (1, 6) | (1, 7) | |
| (2, 4) | (2, 6) | |||||
| (3, 6) | ||||||
Albert: Bernard still doesn't know my number.
Again, from the above table, we can see that Bernard does not know Albert’s number only if div2 = 6. In order for Albert to be sure that Bernard does not know Albert’s number, Albert must know that div2 = 6; this is only possible if div1 = 3. It follows that (div1, div2) = (3, 6).
Answer: div1 = 3, div2 = 6.
The first thing to understand in this puzzle is that there are edges which are impossible to uniquely specify given only the connectivity data of the graph, but no other distinguishing features. For example, the two edges labelled 7 in the below graph are indistinguishable:
In particular, any true statement one can make about one of the edges labelled 7 that only uses the connectivity information of the graph will also be a true statement about the other edge labelled 7 — for example “this edge is adjacent to one vertex of degree 2 and one vertex of degree 6” is true for both edges. Mathematically, two edges are indistinguishable if there exists a graph automorphism mapping one edge to the other. In the above drawing, we have highlighted all indistinguishable edges in red, and labelled edges which are indistinguishable from each other with the same number.
In the analysis that follows, let us write E to denote Cheryl’s edge, A to denote the vertex given to Albert, and B to denote the vertex given to Bernard.
Albert: I don’t know if there’s any conversation we can have where I will learn which edge is Cheryl’s edge.
When is it the case that Albert cannot figure out which edge is Cheryl’s edge E? If Eis distinguishable from all other edges, then Albert and Bernard can both figure out which edge this corresponds to in their drawing by combining their information. If E is indistinguishable from some other edge, then it might still be the case that Albert can still identify E — for example, if only one of those two edges are incident with A. However, if Cheryl’s edge is indistinguishable from another edge incident with A, nothing Bernard can tell Albert can help Albert distinguish between the two edges (and identify E).
In summary, Albert cannot identify E iff A belongs to two red edges with the same label, one of which is E. Since Albert does not know if it is possible for him to identify E, A must be adjacent to at least two red edges with the same label, and to at least one other edge that is “distinguishable” for Albert (either a black edge or a red edge with a unique label among the red edges incident with A). This allows us to reduce the set of possibilities for A to the green vertices in the following image:
Bernard: I don’t know if there’s any conversation we can have where I will learn which edge is Cheryl’s edge.
Similarly, Bernard does not know if it is possible for him to identify E. Similar to before B must be adjacent to two red edges with the same label and at least one other “distinguishable” edge — however now it is additionally important that these edges are not eliminated by what Bernard knows about the possibilities for A from Albert’s first statement (i.e. the other endpoints of these edges must be green vertices). From this, we can see that the only candidates for B are the purple diamonds in the following image:
Albert: I know Cheryl’s edge.
Since each purple diamond is a possible candidate for B, in order for Albert to know Cheryl’s edge (and thus B), A must be adjacent to a unique purple diamond. Since A must be either a green circle or purple diamond, this reduces the set of possibilities for A to the black crosses in the following image:
Bernard: I know Cheryl’s edge.
Similarly, this means B must be adjacent to a unique candidate for A (black cross). The only purple diamond adjacent to a unique black cross is the one belonging to the two red edges labelled “6”. In particular, this lets us conclude that Cheryl’s edge is the dashed blue edge in the following picture:
There are 8 edges in the graph that share exactly one endpoint with this edge.
Answer: edges = 8
Since there are a very large number of 5-by-5 nonograms (approximately 225 ≈ 32M), we will not keep track of the set of possible nonograms explicitly. Instead, we will make several deductions about properties of the nonogram as we go along.
Albert: I don't know whether the first two columns of the grid have any filled-in squares.
If Albert doesn’t know whether the first two columns of the grid have any filled-in squares, it must be possible for all of Albert’s clues to fit within the last three columns of the grid (for example, the clue [1 1] fits within the last three columns of the grid, but the clue [2 2] does not). This means all of Albert’s clues must belong to the set {[0], [1], [2], [3], [1 1]}.
(Also, it cannot be the case that all of Albert’s clues are [0], but this will also become evident from other clues).
We will break Bernard’s next statement into three parts.
Bernard: I already knew you didn't know that.
How can Bernard possibly know that Albert’s clues all fit within the last three columns of the grid? One way this is possible is if Bernard knows that all the cells in the solution lie within a span of 3 consecutive columns; in other words, if Bernard’s 5 clues take the form (?, ?, ?, [0], [0]), ([0], ?, ?, ?, [0]), or ([0], [0], ?, ?, ?) where we use ? here to denote any possible clue. Another way it is possible is if Bernard has 2 or fewer non-zero clues; in this case regardless of the location of Bernard’s non-zero clues, all of Albert’s clues will belong to {[1 1], [2], [1], [0]} and therefore could fit within a span of three columns.
We next claim that the above characterization is necessary. In particular, if Bernard has at least 3 non-zero clues, then Bernard has exactly 3 non-zero clues and they are in a span of 3 consecutive columns (i.e. Bernard’s clues take one of the three forms listed above). If not, look at the locations of Bernard’s non-zero clues; if these non-zero clues span a set of columns of width > 3, then Bernard can imagine a consistent nonogram where one of Albert’s clues has width > 3, contradicting Albert’s earlier statement. For example, if Bernard’s clues were ([1 1] [0] [2 2] [3] [0]) then as far as Bernard knows at the very beginning of the conversation, the nonogram could be:
In this case, Albert’s first clue is [1 2], which does not fit within a span of width 3. In general, Bernard can perform this trick of shifting his non-zero clues as high up as possible and cause Albert’s first clue to have minimum width larger than 3.

We further know that one of these three non-zero columns is completely filled in. As a side-effect, we now know that Albert cannot have any [0] clues.
Bernard: I don't know if the filled-in squares form an orthogonally-connected region.
There are several deductions possible from this statement, but the most useful one is that the [5] cannot appear as the middle clue of the three non-zero columns — this is since if we place the [5] in the middle, no matter what we place on either side of the [5], the resulting set of black squares will be orthogonally-connected. Similarly, this rules out the possibility that there are fewer than 3 non-zero columns. We will also use the fact that this rules out the possibility that Bernard has two or more [5] clues; if so, the resulting region will be orthogonally-connected, no matter how we place the [5]s.
Before proceeding onto Albert’s next statement, let’s take stock of what Albert now knows about the nonogram — as we will soon see, Albert knows quite a bit.
We (and therefore Albert) know that:
From now on, call this smaller 5-by-3 region the subgrid. We now claim that Albert knows the contents of this subgrid almost uniquely — in fact, we will show that Albert has exactly two possibilities for the contents of this subgrid, and they are horizontal reflections (across some vertical line) of one another.
To see why, we claim that as soon as Albert fixes the location of the [5] in the subgrid, Albert can fill in the rest of the subgrid from his clues. In particular, recall that all of Albert’s clues belong to the set {[1], [2], [3], [1 1]}. For each of these clues, specifying the location of the left-most black square and the fact that they have to fit within a span of three columns allows us to uniquely place the black squares:
| [1] | |||
|---|---|---|---|
| [2] | |||
| [3] | |||
| [1 1] |
Similarly, specifying the location of the right-most black square and the fact that they have to fit within a span of three columns also allows us to uniquely place the black squares, and in fact doing so results in a horizontal reflection of the solution we get in the first case.
We have therefore shown that Albert knows the contents of the subgrid up to a horizontal reflection. Since the contents of the grid cannot be symmetric with respect to such a reflection (in particular, only one of the two side columns can be a [5]), Albert has exactly two possibilities for the content of the subgrid.
Finally, what does Albert know about the location of the subgrid? If we look at Bernard’s previous statement, we’ll see that so far, the answer is nothing — if Bernard’s statement is true for a specific nonogram, it is also true for the nonogram formed by shifting the subgrid horizontally in the main 5-by-5 grid. Since there are three possible 5-by-3 subgrids, this means that right now Albert has exactly 6 candidates for the solution to the nonogram.
Albert: I don't know if you know whether the center of the grid is filled in, but I know whether the center of the grid is filled in.
Let us first focus on the fact that Albert knows whether the center of the grid is filled in. As we have just established, Albert knows the contents of the subgrid up to reflection, but does not know the location of the subgrid in the main grid. If Albert’s center row is not a [3], then there is necessarily an empty square somewhere in the center row of the subgrid, and there is some translation of this subgrid which places this empty square at the very center of the grid. But similarly, since Albert’s center row is not a [0], there is necessarily a filled-in square somewhere in the center row of the subgrid, and it’s therefore also possible that the center is filled-in. It follows that the only way Albert can make this statement is if Albert’s middle clue is a [3]. Note that this means that Albert actually knows the stronger statement that the center of the grid is filled in.
Albert also does not know if Bernard knows whether the center of the grid is filled in. While it is possible to deduce some facts from this right now (for example, we can guarantee that Bernard’s two other clues apart from the [5] are not both [3]s), we’ll return to this fact later.
Bernard: I did not know whether the center of the grid was filled in, but I do now. In addition, I now know that the filled-in squares form an orthogonally-connected region. I don't know if you know the shape formed by this region (where two shapes are the same if they can be translated and rotated to match).
Again, Bernard is saying several different things in this clue. We’ll actually start with the last statement Bernard says — that Bernard does not know whether Albert knows the shape formed by the region of filled-in squares (up to rotation and translation).
This is an interesting statement, since as noted above, we (and thus Bernard) know that Albert does know the shape formed by this region up to reflection. Moreover, without rotation, we know that Albert has two candidate possibilities for the shape, since we know the shape is not symmetric with respect to a horizontal reflection, and nothing Bernard has said so far distinguishes this nonogram from its horizontal reflection.
So when is it the case that two distinct shapes that are (horizontal) reflections of each other can be transformed into one another by rotations / translations? The answer is when the shape possesses an axis of symmetry. Since we know our shape does not have horizontal symmetry, if it has this property, it must have vertical symmetry.
In particular, since Bernard does not know the shape formed by this region, Bernard must believe it is possible that the shape has vertical symmetry. In particular, it must be the case that each of Bernard’s clues has the potential to be symmetric about the center row. This rules out many possible clues for Bernard, and leaves only {[1], [3], [1 1], [1 1 1]} as possible clues (in addition to the [5] which we know occurs exactly once. In fact, we can further rule out [1 1], since Bernard also knows (as we do) that from Albert’s statements, the middle row of the subgrid is filled in. There is no way to place a [1 1] column clue symmetrically about the middle row while also filling in the middle square of the column. The remaining clues therefore must belong to the set {[1], [3], [1 1 1]}.
Let us now revisit the other parts of Bernard’s statement. Bernard begins by stating that he did not know whether the center of the grid was filled in, but he does now. This second bit (that he does now) conveys no information, since even we know that the center of the grid is filled in, but the fact that he did not originally tells us that whatever clue Bernard has for the center column (of the original grid, not the subgrid) must not reveal that the center is filled-in — in particular, it must be [1] (since [3] and [1 1 1] reveal this).
We now know two of Bernard’s clues are [1] and [5]. The remaining clue must be one of [1], [3], and [1 1 1]. In fact, Bernard’s sequence of three non-zero clues (up to reflection) must be one of ([5], [1], [1]), ([5], [1], [3]), ([5], [3], [1]), ([5], [1 1 1], [1]). (We eliminated ([5], [1], [1 1 1]) since this cannot possibly be connected).
Albert: I do not. In particular, I do not know whether the cell in row 4 column 2 is filled in (although I do know that all four corners of the grid are empty).
Albert does not know the shape, so Albert’s clues (and thus the shape) must not actually be vertically symmetric. Note that this rules out ([5], [1 1 1], [1]) from the above list. This also rules out ([5], [1], [1]) since if the center row of the subgrid is filled in, this pattern is necessarily vertically symmetric. We are therefore down to ([5], [3], [1]) and ([5], [1], [3]) (up to reflection, so ([1], [3], [5]) and ([3], [1], [5]) are also still possible).
Albert also tells us that all four corners of the grid are empty. Note that this is not possible if the pattern is ([5], [3], [1]) — if the pattern is ([5], [3], [1]) then in order for Bernard to not originally know whether the center is filled in, the [5] must occur in either the first column or last column, which would result in two corners being filled in. The clues for the subgrid are thus either ([5], [1], [3]) or ([3], [1], [5]), and the subgrid must be located in the middle three columns of the grid. Equivalently, Bernard’s five clues for the grid must either be ([0], [5], [1], [3], [0]) or ([0], [3], [1], [5], [0]).
Finally, we have our first bit of information that breaks symmetry — Albert states that he does not know whether the cell in row 4 column 2 is filled in. We will return to this bit of information shortly.
Bernard: Until you said that, I did not know whether the cell in row 4 column 2 was filled in, but now I know the solution to the nonogram.
Bernard tells us that he also did not originally know whether the cell in row 4 column 2 was filled in. If Bernard’s clues are ([0], [5], [1], [3], [0]) he knows that all of column 2 is filled in, so Bernard’s clues must be ([0], [3], [1], [5], [0]).
There are only three nonograms consistent with this set of Bernard’s clues and the fact that the center is filled in:
In the latter two of these, Albert’s clue for row 4 is [1 1], and therefore Albert (in combination with the knowledge that the subgrid spans the middle three columns) knows that row 4 column 2 is filled in. It follows that the only possible nonogram is the first of these, namely:
This nonogram depicts the digit 4.
Answer: nonogram = 4
The state abbreviations of all 50 states are summarized by the black squares in the following table (where the row corresponds to the first letter of the state abbreviation, and the column corresponds to the second letter of the state abbreviation):
| A | C | D | E | H | I | J | K | L | M | N | O | R | S | T | V | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A | x | x | x | x | |||||||||||||||
| C | x | x | x | ||||||||||||||||
| D | x | ||||||||||||||||||
| F | x | ||||||||||||||||||
| G | x | ||||||||||||||||||
| H | x | ||||||||||||||||||
| I | x | x | x | x | |||||||||||||||
| K | x | x | |||||||||||||||||
| L | x | ||||||||||||||||||
| M | x | x | x | x | x | x | x | x | |||||||||||
| N | x | x | x | x | x | x | x | x | |||||||||||
| O | x | x | x | ||||||||||||||||
| P | x | ||||||||||||||||||
| R | x | ||||||||||||||||||
| S | x | x | |||||||||||||||||
| T | x | x | |||||||||||||||||
| U | x | ||||||||||||||||||
| V | x | x | |||||||||||||||||
| W | x | x | x | x |
Albert: I don’t know the state.
Albert’s row of the table must contain at least 2 black squares. This lets us eliminate rows D, F, G, H, L, P, R, and U.
| A | C | D | E | H | I | J | K | L | M | N | O | R | S | T | V | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A | x | x | x | x | |||||||||||||||
| C | x | x | x | ||||||||||||||||
| I | x | x | x | x | |||||||||||||||
| K | x | x | |||||||||||||||||
| M | x | x | x | x | x | x | x | x | |||||||||||
| N | x | x | x | x | x | x | x | x | |||||||||||
| O | x | x | x | ||||||||||||||||
| S | x | x | |||||||||||||||||
| T | x | x | |||||||||||||||||
| V | x | x | |||||||||||||||||
| W | x | x | x | x |
Bernard: I don't know the state.
Similarly, Bernard’s column of the table must contain at least 2 black squares. This lets us eliminate columns J, M, X, and Z.
| A | C | D | E | H | I | K | L | N | O | R | S | T | V | Y | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A | x | x | x | ||||||||||||
| C | x | x | x | ||||||||||||
| I | x | x | x | x | |||||||||||
| K | x | x | |||||||||||||
| M | x | x | x | x | x | x | x | x | |||||||
| N | x | x | x | x | x | x | |||||||||
| O | x | x | x | ||||||||||||
| S | x | x | |||||||||||||
| T | x | ||||||||||||||
| V | x | x | |||||||||||||
| W | x | x | x | x |
Albert: I don't know the state.
Albert’s row of the table must again contain at least 2 black squares. This lets us eliminate row T. Before we eliminate it, let’s consider the next two statements as well.
Bernard: I already knew that.
Bernard already knew that Albert didn’t know the state — in other words, Bernard already knew that Albert’s letter is not T. Since TN is the only state abbreviation where it is possible for Albert’s letter to be T, this means that we can eliminate column N for Bernard.
Albert: Well I already knew that you already knew that.
Albert already knew that Bernard already knew that Albert didn’t know the state. From the above logic, this means that Albert already knew that Bernard’s letter was not N. Since IN and MN are also states, this means that Albert cannot have the letter I or M.
All in all, this lets us eliminate rows I, M, and T for Albert, and column N for bernard.
| A | C | D | E | H | I | K | L | O | R | S | T | V | Y | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A | x | x | x | |||||||||||
| C | x | x | x | |||||||||||
| K | x | x | ||||||||||||
| N | x | x | x | x | x | x | ||||||||
| O | x | x | x | |||||||||||
| S | x | x | ||||||||||||
| V | x | x | ||||||||||||
| W | x | x | x | x |
Bernard: I still don't know what the state is.
We can eliminate columns with a unique black square. This allows us to eliminate columns E, I, L, O, and S.
| A | C | D | H | K | R | T | V | Y | |
|---|---|---|---|---|---|---|---|---|---|
| A | x | x | |||||||
| C | x | x | |||||||
| K | x | ||||||||
| N | x | x | x | x | x | ||||
| O | x | x | x | ||||||
| S | x | x | |||||||
| V | x | x | |||||||
| W | x | x | x |
Albert: I also don't know what the state is.
We can eliminate rows with a unique black square. This allows us to eliminate row K.
| A | C | D | H | K | R | T | V | Y | |
|---|---|---|---|---|---|---|---|---|---|
| A | x | x | |||||||
| C | x | x | |||||||
| N | x | x | x | x | x | ||||
| O | x | x | x | ||||||
| S | x | x | |||||||
| V | x | x | |||||||
| W | x | x | x |
Bernard: Again, I still don't know the state.
Again, we can eliminate columns with a unique black square, but no such columns exist.
Albert: Well, I don't even know how many states you still think are possibly the correct state.
The number of states Bernard possibly thinks are the correct state is equal to the number of black squares in Bernard’s column. We therefore want to eliminate rows where each black square in the row contains the same number of black squares in its column.
By inspection, this is true for rows A, N, O, and S, which we now eliminate (along with columns left with 0 remaining black squares).
| A | T | V | Y | |
|---|---|---|---|---|
| C | x | x | ||
| V | x | x | ||
| W | x | x | x |
Bernard: Well, I know how many possibilities you have narrowed down the state to.
Similarly, we now want to eliminate columns where each black square in the column does not appear the same number of times in its row. This eliminates column A.
| T | V | Y | |
|---|---|---|---|
| C | x | ||
| V | x | ||
| W | x | x |
Albert: I now know the state. By the way, the state does not border Canada.
Since Albert knows the state, Albert’s row is C or V and the state is either CT or VT. Of these two states, Vermont (VT) borders Canada, whereas Connecticut (CT) does not, so the answer to this puzzle is CT. (The remaining line of dialogue conveys no further information).
Answer: CT
Albert: I don’t know whether you know my number.
Before this statement, Bernard knows Albert’s number if and only if Bernard’s number is a prime p (which would allow him to deduce that the set is {1, p} and that Albert’s number is 1 + p) or a square of a prime p2 (which would allow him to deduce that the set is {1, p2} and that Albert’s number is 1 + p2). (Note that Bernard’s number can never be 1, which is not the product of two or more distinct positive integers.) Any other number n has a nontrivial factorization n = pq where p and q are distinct integers > 1, and Bernard would not be able to distinguish between {1, pq} and {p, q}. So, if Albert believes it’s possible that Bernard knows Albert’s number, we know that Albert’s number is of the form 1 + p or 1 + p2.
We can further eliminate some small cases for Albert’s number. If Albert’s number is 3, Albert can deduce that the set is {1, 2} and that Bernard’s number is 2, which is also enough to deduce the set. In this case Albert would know that Bernard knows Albert’s number, which is impossible.
Similarly, if Albert’s number is 4, Albert can deduce that the set is {1, 3} and that Bernard’s number is 3, which is also enough to deduce the set, so this case can be eliminated as well.
Larger numbers are still consistent, however: If Albert has 5, the set could be {1, 4} or {2, 3}, making Bernard’s number 4 or 6. If Albert has 6, the set could be {1, 5}, {2, 4}, or {1, 2, 3}, making Bernard’s number 5, 8, or 6. Larger numbers give even more possibilities for the set and for Bernard’s number.
Bernard: I know your number, and now I know you know my number too.
We’ve already eliminated Albert’s number being 3 or 4. We can check that, if the set is {1, 4} so that Albert’s number is 5 and Bernard’s number is 4, everything is consistent:
If Albert’s number is none of the above, it’s at least 6 and is one more than either an odd prime or the square of an odd prime, so it must be an even number ≥ 6.
If it’s 6, we can actually check that when Bernard’s number is either 5 or 8, Bernard can deduce the set and Albert’s number:
Otherwise, Albert’s number is an even number greater than 6, and we know that it’s less than 4 × 1018. Let it be A. Here we will lean on empirical verification of a slightly strengthened version of Goldbach’s conjecture, and write A as the sum of two distinct primes q + r. Now:
Therefore, there are at least two possible values of Bernard’s number that would enable him to say that Bernard knows Albert’s number, so Albert cannot know Bernard’s number after the first half of Bernard’s statement, and Bernard certainly could not conclude that either.
We have therefore eliminated all cases except the set {1, 4}, where Albert gets 5 and Bernard gets 4.
Answer: sum = 5, product = 4
Before we start examining the conversation between Albert and Bernard, let’s attempt to better understand what statements like “Albert knows whether Bernard knows whether Albert knows the numbers” imply about the numbers given to Albert and Bernard.
As in the puzzle description, assume that Albert and Bernard are given positive integers a and b respectively such that either a = b or a = b + 1 (for now we will not worry about the upper bound on a and b). We will now define a statement W(n) for each non-negative integer n ≥ 0, such that the statement W(n) contains n “whether”s. Let W(0) be the statement “Albert knows Bernard’s number”. Now for any n > 0, let W(n) be the statement “Bernard knows whether W(n−1) is true” if n is odd, and let W(n) be the statement “Albert knows whether W(n−1) is true” if n is even. The first couple statements W(n) can be written out as follows:
What does the statement W(n) imply about a and b? To start, note that W(0) implies that a = 1 (and b = 1), since this is the only setting where Albert knows Bernard’s number uniquely. Given this, we can reinterpret W(1) as “Bernard knows whether a = 1”. If b > 1, then Bernard knows that a cannot possibly be 1; however if b = 1, a could be either 1 or 2 (so Bernard does not know the truth of W(0)). In particular, W(1) implies that b ≠ 1.
Similarly, we can reinterpret W(2) as “Albert knows whether b ≠ 1”. Certainly if a = 1, Albert knows that b = 1 (and therefore whether b ≠ 1). Similarly, if a > 2, Albert knows that b > 1, and thus knows that b ≠ 1. However, if a = 2, Albert does not know if b = 1 or 2. W(2) therefore implies that a ≠ 2.
We can continue onwards to figure out the implication of W(n) for ever increasing values of n. More succinctly, for each value of W(n), we learn either that a cannot belong to some set of values S(n) (if n is even), or that b cannot belong to some set of values S(n) (if n is odd). Moreover, the rule for constructing S(n) from S(n−1) is relatively simple:
This lets us quickly construct the following table of sets S(n) (where a cell is filled-in if the corresponding element belongs to S(n)):
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| S(1) | |||||||||||
| S(2) | |||||||||||
| S(3) | |||||||||||
| S(4) | |||||||||||
| S(5) | |||||||||||
| S(6) | |||||||||||
| S(7) | |||||||||||
| S(8) | |||||||||||
| S(9) | |||||||||||
| S(10) | |||||||||||
| S(11) | |||||||||||
| S(12) | |||||||||||
| S(13) | |||||||||||
| S(14) | |||||||||||
| S(15) | |||||||||||
| S(16) | |||||||||||
| S(17) | |||||||||||
| S(18) | |||||||||||
| S(19) | |||||||||||
| S(20) |
(Observant solvers might notice that drawing out this table results in a fractal pattern similar to half of Sierpinski’s triangle).
We are now ready to analyze the conversation between Albert and Bernard.
Albert: I know whether you know my number.
Bernard knows Albert’s number only if b = 11, so we know that a ≠ 11.
Bernard: I know whether you know my number.
Albert knows Bernard’s number only if a = 1, so we know that b ≠ 1.
Albert: I know whether you know my number.
We have a repeat of the first line, except now we (and Albert and Bernard) know that a≠ 11 and b ≠ 1. This is equivalent to Cheryl originally choosing numbers between 2 and 10 inclusive for Albert and Bernard. It similarly follows that this implies that a ≠ 10.
Bernard: I know whether you know whether I know whether you know whether I know whether you know whether I know whether you know whether I know whether you know whether I know whether you know whether I know whether you know my number.
We can verify that this statement is equivalent to W(13). Since we know that b ≠ 1, and a ≠ 10, 11, if we let a’ = a − 1 and b’ = b − 1, we can instead pretend that Cheryl gave Albert and Bernard numbers a’ and b’ between 1 and 8 inclusive with the property that either a’ = b’ or a’ = b’+ 1.
Reading off S(13) from the above table, we know that W(13) implies that b’ cannot equal 2, 3, 6, or 7. In particular, this means that b cannot equal 3, 4, 7, or 8.
Albert: I don't know your number.
We now have the following remaining options for a and b. We know that b cannot equal 1, 3, 4, 7, or 8. We also know that a cannot equal 10 or 11. Together, this means that (a, b) must be one of (2, 2), (3, 2), (5, 5), (6, 5), (6, 6), (7, 6), or (9, 9). Of these possibilities, the only cases in which Albert cannot uniquely identify Bernard’s number are if a = 6 and b = 5 or 6. It follows that Albert’s number is 6.
Answer: whether = 6
At the beginning of this part of the puzzle, Cheryl whispers information to Albert. Afterward, Albert knows the exact value of whisper1 and may additionally have some information about the value of whisper2. We’ll approach this part of the puzzle by considering all possibilities for what Albert may know about the pair (whisper1, whisper2).
Albert: I don’t know your number.
At this point, there are nine possibilities for what Albert may know about the pair (whisper1, whisper2). Let us call them 1(a, b, c, d), 2(a, b, c, d), and 3. They are as follows.
These possibilities can be summarized in a table similar to the ones used in previous parts of this solution. The columns of the table correspond to the nine possibilities listed above (Albert’s knowledge), and the rows of the table correspond to the five possible values of whisper2 (Bernard’s knowledge). The white cells correspond to the possible states of Albert’s and Bernard’s knowledge.
| 1(a) | 1(b) | 1(c) | 1(d) | 2(a) | 2(b) | 2(c) | 2(d) | 3 | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | |||||||||
| 2 | |||||||||
| 3 | |||||||||
| 4 | |||||||||
| 5 |
Bernard: Then you don’t know whether my number is greater than your number.
Albert knows whether whisper2 > whisper1 in exactly scenarios 1(b) and 2(b). So we remove rows 2, 3, and 4 of the table, because they contain a white cell in column 1(b) or 2(b). Let’s also clean up the columns that have no remaining white cells.
| 1(a) | 1(c) | 1(d) | 3 | |
|---|---|---|---|---|
| 1 | ||||
| 5 |
Albert: I now know your number.
We now remove any column that contains more than one white cell, leaving only the possibility that whisper1 = 1 and whisper2 = 1.
Answer: whisper1 = 1, whisper2 = 1
By substituting in the answers from all the subpuzzles, we obtain the following conversation.
Albert: I don't know if the answer contains exactly 4 vowels.
Bernard: I don't know if the answer contains exactly 4 vowels.
Albert: I don't know if the answer contains CT as a substring.
Bernard: I don't know if the answer contains CT as a substring.
Albert: I don't know if the sum of the 1st and 5th letters (where A=1, B=2, ...) is at least 8.
Bernard: I don't know if the sum of the 1st and 5th letters (where A=1, B=2, ...) is at least 10.
Albert: I don’t know if the Scrabble score of the answer is equal to 8.
Bernard: I don’t know if the Scrabble score of the answer is equal to 6.
Albert: I don't know if the set of letters in the answer contains 4 consecutive letters.
Bernard: I don't know if the set of letters in the answer contains 4 consecutive letters.
Albert: I don’t know if the 1st letter, the 3rd letter, and the 6th letter of the answer form a common English word when concatenated.
Bernard: I don’t know if the 6th letter, the 1st letter, and the 4th letter of the answer form a common English word when concatenated.
Albert: I don’t know if the product of all the letters (where A=1, B=2, ...) in the answer is divisible by 32.
Cheryl: Oh, I forgot to tell you this earlier, but all the letters in the answer are distinct.
Bernard: I know the answer to this puzzle.
Albert: I know the answer to this puzzle.
We now proceed as usual.
Albert: I don't know if the answer contains exactly 4 vowels.
The only way Albert is sure that the answer does not contain exactly 4 vowels is if Albert’s trigram contains no vowels. It follows that Albert’s trigram must contain a vowel.
Bernard: I don't know if the answer contains exactly 4 vowels.
Similarly, this is possible if and only if Bernard’s trigram contains at least one vowel (even though Bernard knows that Albert’s trigram contains at least one vowel, Bernard’s trigram could still contain 1, 2, or 3 vowels and satisfy the constraint that the answer contains 4 vowels).
Albert: I don't know if the answer contains CT as a substring.
This implies that Albert’s trigram does not contain CT as a substring. If Albert’s trigram does not contain CT, then CT can still occur as a substring of the answer either by occurring entirely within Bernard’s trigram or occurring across trigram boundaries (as the 3rd and 4th letters).
Bernard: I don't know if the answer contains CT as a substring.
Again, this implies that Bernard’s trigram does not contain CT as a substring. Furthermore, since Bernard knows that Albert’s trigram does not contain CT as a substring, it must be possible for CT to appear across trigram boundaries. This implies that the fourth letter of the answer (and the first letter of Bernard’s trigram) is a T.
Summarizing, so far we know that Albert’s trigram is ??? (one letter of which must be a vowel), and Bernard’s trigram is T?? (one letter of which must be a vowel).
Albert: I don't know if the sum of the 1st and 5th letters (where A=1, B=2, ...) is at least 8.
As far as Albert knows, the 5th letter can be any letter. In order for the sum to possibly be below 8, this means that the value of the first letter must be between 1 and 6, so the first letter of the answer is between A and F inclusive.
[A-F]??, T??
Bernard: I don't know if the sum of the 1st and 5th letters (where A=1, B=2, ...) is at least 10.
Bernard knows that the first letter has value between 1 and 6. In order for it to be possible for the sum to both be below 10 and at least 10, the fifth letter of the answer (Bernard’s second letter) must be between 4 and 8 in value. The fifth letter is thus between D and H inclusive.
[A-F]??, T[D-H]?
Albert: I don’t know if the Scrabble score of the answer is equal to 8.
It is useful here to recall the mapping from letters to Scrabble values:
Note that there are very few possible ways a six-letter word can have a Scrabble score of 8; either it must contain five 1-point letters and one 3-point letter, or four 1-point letters and two 2-point letters. In particular, if Albert makes this claim, it is not possible for any of his letters to be worth 4 or more points (and as long as all of his letters are worth at most 5 points total, it is possible that this constraint is satisfied). In particular, Albert’s first letter cannot be F.
[A-E]??, T[D-H]?
Bernard: I don’t know if the Scrabble score of the answer is equal to 6.
This is an even stronger statement — it implies that all of the letters in Bernard’s trigram must be worth 1 point. This is true for the T, but reduces the possibilities for the second letter of Bernard’s trigram to just E.
[A-E]??, TE?
Albert: I don't know if the set of letters in the answer contains 4 consecutive letters.
Let us think about the possible ways in which the answer can contain 4 consecutive letters. Any such streak of 4 consecutive letters must contain letters from both trigrams. Moreover, since the fourth and fifth letters (the T and the E) cannot belong to the same streak of length 4, this streak must contain at least two letters from Albert’s trigram.
Let’s first consider the case where the streak contains 3 letters from Albert’s trigram. Then the streak must contain a letter between A and E, so it must be one of ABCD, BCDE, CDEF, DEFG, or EFGH. However, since we can have at most one 3-point value letter and at most two 2-point value letters in our answer (and no letters of higher value), this rules out all these possibilities.
The streak must then contain 2 letters from Albert’s trigram and 2 letters from Bernard’s trigram. As previously mentioned, the two letters from Bernard’s trigram cannot be the fourth and fifth letters. Let us now consider the case that they are the fifth and sixth letters (i.e. the E and the ?). However, this case is impossible, since all streaks of length 4 containing an E have too high of a scrabble value.
It follows that the streak must contain the fourth and sixth letters from Bernard’s trigram, and (since the fourth letter is a T) be one of QRST, RSTU, STUV, TUVW. Of these choices, all have too high of a Scrabble value except for RSTU. Finally, since the first letter must be between A and E, the streak must contain the second and third letters (and therefore the second, third, fourth, and sixth letters must be RSTU in some order). In fact, since the fourth letter is the T, the second, third, and sixth letters must be RSU in some order.
Importantly, this means that as long as Albert’s second and third letters are two distinct letters from the set [RSU], it is possible that the answer contains 4 consecutive letters.
[A-E][RSU][RSU], TE?
Bernard: I don't know if the set of letters in the answer contains 4 consecutive letters.
By following the above logic, Bernard also knows that the only way the answer can contain 4 consecutive letters is if it contains all the letters in RSTU. From Albert’s previous statement, Bernard knows that Albert has two of the letters in the set {R, S, U} as his second and third letter. In order for it to be possible that the answer contains 4 consecutive letters, Bernard must also have a letter in the set {R, S, U} as his third letter (and as the answer’s sixth letter).
[A-E][RSU][RSU], TE[RSU]
Albert: I don’t know if the 1st letter, the 3rd letter, and the 6th letter of the answer form a common English word when concatenated.
There are fifteen possibilities for the bigram formed by the first and third letters of the answer: AR, AS, AU, BR, BS, BU, CR, CS, CU, DR, DS, DU, ER, ES, and EU. For each of these possibilities, let us look at whether it is possible for it to form a common English word when concatenated with the sixth letter (which is one of R, S, and U):
This bigram therefore must be one of AS, BU, CU, ER, or ES. In particular, the first letter cannot be D.
[ABCE][RSU][RSU], TE[RSU]
Bernard: I don’t know if the 6th letter, the 1st letter, and the 4th letter of the answer form a common English word when concatenated.
Bernard knows that the 6th letter is one of R, S, or U, and that the 4th letter is T. If the 6th letter is R, then Bernard knows it is possible for this concatenation to be RAT (which is a common English word) and also possible for it to be RBT (which is not a common english word). If the 6th letter is S, then Bernard knows it is possible for this concatenation to be SAT (a common English word) and also for it to be SBT (not a common English word).
However, if the 6th letter is U, then no matter the choice of first letter in {A, B, C, E}, this concatenation will not form an English word — it will form one of UAT, UBT, UCT, and UET. It follows that the 6th letter cannot be U.
[ABCE][RSU][RSU], TE[RS]
Albert: I don’t know if the product of all the letters (where A=1, B=2, ...) in the answer is divisible by 32.
Albert knows that Bernard’s trigram is either TER, with product 20 × 5 × 18 = 23 × 32 × 52, or TES, with product 20 × 5 × 19 = 22 × 52 × 19. In order for Albert to not know whether the product of all the letters is divisible by 32, the highest power of two dividing Albert’s trigram must be exactly 4; then if Bernard’s trigram is TER, the overall product is divisible by 32, and if Bernard’s trigram is TES, the overall product is not divisible by 32.
Now, the only possible even-valued letters in Albert’s trigram are B (with value 2), which can occur in the first position, and R (with value 18) which can occur in the second or third position (but not both, since the second and third letters must be distinct elements of {R, S, U}). Since both B and R just contribute a single power of 2 to the product, they must both appear in Albert’s trigram — in particular, Albert’s trigram begins with the letter B.
From our earlier analysis of bigrams, we know that if the first letter of the answer is B, the third letter of the answer must be U. Since R must appear somewhere in Albert’s trigram, the second letter of the answer is R.
BRU, TE[RS]
Cheryl: Oh, I forgot to tell you this earlier, but all the letters in the answer are distinct.
There are now exactly two possibilities available for the answer: BRUTES and BRUTER. Since Cheryl now tells us that all the letters are distinct, we can conclude (along with Albert and Bernard) that the answer to this puzzle is BRUTES.


Using Advanced Analytics to leverage data
Case:
An International Shipping company had accumulated years of booking and operational data. The data was used in they monthly report and for their Year Over Year (YoY) gain but ignored thereafter.
Management saw value in this data and called upon a set of data scientists to find if there were some ‘value´ in the data.
Process:
The process in data mining is to join business users with data scientists. Together, they create a business and data understanding. This was done though small workshops where data and business ideas were explored. The 2 teams helped each other understanding the possibilities. A set of ideas were retained: the early identification of customer churn and volume prediction.
The data scientist and IT experts collected the right information. Business users validated the assembled data. The data scientist and IT specialists started to build a set of models.
The models were run, evaluated by the business and refined. Once the data was collected, the cycle of refinement-evaluation took 2 weeks. Total project time was short, about 4 months.
Tools:
An important component, the commodities shipped were classified using the Simple Bayesian Classification algorithm. The clustering analysis used the “Density-based Spatial Clustering of Application with Noise” (DBSCAN). Bespoke time series and seasonality analysis were developed for the problem using customer input and refinements. The R language was used to model the algorithms.
Result:
The historical data could be used to detect churning ahead of time. On selected market, it could also be used for prediction of volume. The findings of the clustering analysis surprised the business as some were counter intuitive. The counter intuitive findings were studied in depth and were, after several rounds of validations, correct.
Data Mining using Big Data Technologies Big data was designed for Data Mining. Despite the popularity of big-data technologies (Hadoop, Map/Reduce, Pig Latin, Hive, U-SQL, etc.) for traditional data warehousing, the number of algorithms, readily available has increased and the integration of the R language in this technology makes data mining possible at reasonable cost.
Out of the 1000’s of algorithms available to data scientist, some have proven themselves across time. Ange Analytics have used several of the ‘long standing’ algorithms in the areas of Decision Tree, Associative Rules, Support Vectors, Clustering, Bayesian Network, Rule Based machine learning and Optimisation.
Ange has also developed several optimisation tools using linear and integer programming for the shipping, air and trading industries.