ชั่งครั้งที่ 1 CASE all A = all B,
ชั่งครั้งที่ 2 if A1+A2 = C1+C2 then
** either c3 or c4 is different
ชั่งครั้งที่ 3 if A1 = C3 then
The different coin is C4
Else
The different coin is C3
Endif
Else ** either c1 or c2 is different
ชั่งครั้งที่3 if A1 = C1 then
The different coin is C2
Else
The different coin is C1
Endif
Endif
ชั่งครั้งที่ 1 CASE all A < (เบากว่า) all B,
** แบ่งกลุ่ม B ออกเป็นสองข้าง และหยอด A ข้างละลูก
ชั่งครั้งที่ 2 Begin Case ** A1 B1 B2 VS B2 B3 B4
Case A1+B1+B2 < A2+B3+B4,
** ความเป็นไปได้เหลือ B3, B4 heavy coin หรือ A1 light coin
ชั่งครั้งที่ 3 begin case ** B3 VS B4
case B3 = B4
The different coin is A1
case B3 < B4
The different coin is B4
case B3 > B4
The different coin is B3
endcase
ชั่งครั้งที่ 2 Case A1+B1+B2 > A2+B3+B4,
** ความเป็นไปได้เหลือ B1, B2 heavy coin หรือ A2 light coin
ชั่งครั้งที่ 3 begin case ** B1 VS B2
case B1 = B2
The different coin is A2
case B1 < B2
The different coin is B2
case B1 > B2
The different coin is B1
endcase
ชั่งครั้งที่ 2 Case: A1+B1+B2 = A2+B3+B4,
** A3 หรือ A4 เป็น different light coin
ชั่งครั้งที่ 3 if C1 = A3 then
** compare the known normal with the variable
The different coin is A4
Else
The different coin is A3
Endif
End Case
ชั่งครั้งที่ 1 CASE: all A > all B, ** ใช้ตรรกกะคล้ายcaseก่อน
ชั่งครั้งที่ 2 Begin Case
Case A1+B1+B2 < A2+B3+B4,
** ความเป็นไปได้เหลือ B1, B2 light coin หรือ A2 heavy coin
ชั่งครั้งที่ 3 begin case ** B1 VS B2
case B1= B2
The different coin is A2
case B1< B2
The different coin is B1
case B1> B2
The different coin is B2
endcase
ชั่งครั้งที่ 2 Case A1+B1+B2 > A2+B3+B4,
** ความเป็นไปได้เหลือ B3, B4 light coin หรือ A1 heavy coin
ชั่งครั้งที่ 3 begin case ** B3 VS B4
case B3 = B4
The different coin is A1
case B3 < B4
The different coin is B3
case B3 > B4
The different coin is B4
endcase
ชั่งครั้งที่ 2 Case: A1+B1+B2 = A2+B3+B4,
** A3 หรือ A4 เป็น different heavy coin
ชั่งครั้งที่ 3 if C1 = A3 then
The different coin is A4
Else
The different coin is A3
Endif
End Case
ENDCASE