Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
58
Task/Ternary-logic/PureBasic/ternary-logic.basic
Normal file
58
Task/Ternary-logic/PureBasic/ternary-logic.basic
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
DataSection
|
||||
TLogic:
|
||||
Data.i -1,0,1
|
||||
TSymb:
|
||||
Data.s "F","?","T"
|
||||
EndDataSection
|
||||
|
||||
Structure TL
|
||||
F.i
|
||||
M.i
|
||||
T.i
|
||||
EndStructure
|
||||
|
||||
Structure SYM
|
||||
TS.s{2}[3]
|
||||
EndStructure
|
||||
|
||||
*L.TL=?TLogic
|
||||
*S.SYM=?TSymb
|
||||
|
||||
Procedure.i NOT3(*x.TL)
|
||||
ProcedureReturn -*x
|
||||
EndProcedure
|
||||
|
||||
Procedure.i AND3(*x.TL,*y.TL)
|
||||
If *x>*y : ProcedureReturn *y : Else : ProcedureReturn *x : EndIf
|
||||
EndProcedure
|
||||
|
||||
Procedure.i OR3(*x.TL,*y.TL)
|
||||
If *x<*y : ProcedureReturn *y : Else : ProcedureReturn *x : EndIf
|
||||
EndProcedure
|
||||
|
||||
Procedure.i EQV3(*x.TL,*y.TL)
|
||||
ProcedureReturn *x * *y
|
||||
EndProcedure
|
||||
|
||||
Procedure.i IMP3(*x.TL,*y.TL)
|
||||
If -*y>*x : ProcedureReturn -*y : Else : ProcedureReturn *x : EndIf
|
||||
EndProcedure
|
||||
|
||||
If OpenConsole("")
|
||||
PrintN(" (AND) ( OR) (EQV) (IMP) (NOT)")
|
||||
PrintN(" F ? T F ? T F ? T F ? T ")
|
||||
PrintN(" -------------------------------------------------")
|
||||
For *i.TL=*L\F To *L\T
|
||||
rs$=" "+*S\TS[*i+1]+" | "
|
||||
rs$+*S\TS[AND3(*L\F,*i)+1]+" "+*S\TS[AND3(*L\M,*i)+1]+" "+*S\TS[AND3(*L\T,*i)+1]
|
||||
rs$+" "
|
||||
rs$+*S\TS[OR3(*L\F,*i)+1] +" "+*S\TS[OR3(*L\M,*i)+1] +" "+*S\TS[OR3(*L\T,*i)+1]
|
||||
rs$+" "
|
||||
rs$+*S\TS[EQV3(*L\F,*i)+1]+" "+*S\TS[EQV3(*L\M,*i)+1]+" "+*S\TS[EQV3(*L\T,*i)+1]
|
||||
rs$+" "
|
||||
rs$+*S\TS[IMP3(*L\F,*i)+1]+" "+*S\TS[IMP3(*L\M,*i)+1]+" "+*S\TS[IMP3(*L\T,*i)+1]
|
||||
rs$+" "+*S\TS[NOT3(*i)+1]
|
||||
PrintN(rs$)
|
||||
Next
|
||||
EndIf
|
||||
Input()
|
||||
Loading…
Add table
Add a link
Reference in a new issue