0% found this document useful (0 votes)
244 views1 page

Logic Dice Game: WFF 'N PROOF Rules

WFF 'N PROOF is a logic game where dice with symbols are thrown to form well-formed formulas (WFFs) according to certain rules. The longest WFF that can be formed from the thrown symbols must be determined. Input consists of test cases with symbol strings and output should contain the longest possible WFF or "no WFF possible".

Uploaded by

Hello mister
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
244 views1 page

Logic Dice Game: WFF 'N PROOF Rules

WFF 'N PROOF is a logic game where dice with symbols are thrown to form well-formed formulas (WFFs) according to certain rules. The longest WFF that can be formed from the thrown symbols must be determined. Input consists of test cases with symbol strings and output should contain the longest possible WFF or "no WFF possible".

Uploaded by

Hello mister
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

11103 WFF ’N PROOF

WFF ’N PROOF is a logic game played with dice. Each


die has six faces representing some subset of the possible
symbols K, A, N, C, E, p, q, r, s, t. A Well-formed formula
(WFF) is any string of these symbols obeying the following
rules:
• p, q, r, s, and t are WFFs
• if w is a WFF, Nw is a WFF
• if w and x are WFFs, Kwx, Awx, Cwx, and Ewx are
WFFs.
The meaning of a WFF is defined as follows:
• p, q, r, s, and t are logical variables that may take on the value 0 (false) or 1 (true).
• K, A, N, C, E mean and, or, not, implies, and equals as defined in the truth table below.

Definitions of K, A, N, C, and E
w x Kwx Awx Nw Cwx Ewx
1 1 1 1 0 1 1
1 0 0 1 0 0 0
0 1 0 1 1 1 0
0 0 0 0 1 1 1

Given a collection of symbols resulting from throwing a set of dice, determine the longest WFF that
can be formed from those symbols.

Input
Input consists of several test cases. Each test case is a single line containing a string containing between
1 and 100 of the characters. A line containing ‘0’ follows the last case.

Output
For each test case, output a line containing the longest WFF that can be formed using some subset of
the letters in the string. If there are several such WFFs, any one will do. If no WFF can be constructed,
output a line containing ‘no WFF possible’ as shown below.

Sample Input
qKpNq
KKN
0

Sample Output
KqNq
no WFF possible

You might also like