69 lines
2 KiB
Text
69 lines
2 KiB
Text
|
|
#START_X=-4 : #START_Y=2
|
|||
|
|
Dim pl$(5)
|
|||
|
|
pl$(0)=" Θ " : pl$(1)=" • " : pl$(2)=" •• "
|
|||
|
|
pl$(3)="••• " : pl$(4)="••••" : pl$(5)="‒‒‒‒"
|
|||
|
|
If OpenConsole() : EnableGraphicalConsole(1) : Else : End 1 : EndIf
|
|||
|
|
|
|||
|
|
Procedure.s Dec2Mayan(wert.i)
|
|||
|
|
result$=""
|
|||
|
|
If wert=0 : result$="0;" : EndIf
|
|||
|
|
While wert : result$=Str(wert%20)+";"+result$ : wert/20 : Wend
|
|||
|
|
ProcedureReturn result$
|
|||
|
|
EndProcedure
|
|||
|
|
|
|||
|
|
Procedure PutMayan(may$)
|
|||
|
|
Shared pl$()
|
|||
|
|
X=#START_X+6 : Y=#START_Y
|
|||
|
|
For i=1 To CountString(may$,";")
|
|||
|
|
m=Val(StringField(may$,i,";"))
|
|||
|
|
yp=Y+4
|
|||
|
|
If m=0 : ConsoleLocate(X,yp) : Print(pl$(0)) : X+5 : Continue : EndIf
|
|||
|
|
While m
|
|||
|
|
If m-5>=0
|
|||
|
|
ConsoleLocate(X,yp) : Print(pl$(5)) : yp-1 : m-5
|
|||
|
|
ElseIf m-4>=0
|
|||
|
|
ConsoleLocate(X,yp) : Print(pl$(4)) : yp-1 : m-4
|
|||
|
|
ElseIf m-3>=0
|
|||
|
|
ConsoleLocate(X,yp) : Print(pl$(3)) : yp-1 : m-3
|
|||
|
|
ElseIf m-2>=0
|
|||
|
|
ConsoleLocate(X,yp) : Print(pl$(2)) : yp-1 : m-2
|
|||
|
|
ElseIf m-1>=0
|
|||
|
|
ConsoleLocate(X,yp) : Print(pl$(1)) : yp-1 : m-1
|
|||
|
|
EndIf
|
|||
|
|
Wend
|
|||
|
|
X+5
|
|||
|
|
Next
|
|||
|
|
EndProcedure
|
|||
|
|
|
|||
|
|
Procedure MayanNumerals(may$)
|
|||
|
|
X=#START_X : Y=#START_Y
|
|||
|
|
m.i=CountString(may$,";")
|
|||
|
|
For i=1 To m
|
|||
|
|
X+5
|
|||
|
|
ConsoleLocate(X,Y) : Print("╔════╗")
|
|||
|
|
ConsoleLocate(X,Y+1) : Print("║ ║")
|
|||
|
|
ConsoleLocate(X,Y+2) : Print("║ ║")
|
|||
|
|
ConsoleLocate(X,Y+3) : Print("║ ║")
|
|||
|
|
ConsoleLocate(X,Y+4) : Print("║ ║")
|
|||
|
|
ConsoleLocate(X,Y+5) : Print("╚════╝")
|
|||
|
|
Next
|
|||
|
|
X=#START_X
|
|||
|
|
For i=1 To m
|
|||
|
|
X+5
|
|||
|
|
If i<m
|
|||
|
|
ConsoleLocate(X+5,Y) : Print("╦")
|
|||
|
|
ConsoleLocate(X+5,Y+5) : Print("╩")
|
|||
|
|
EndIf
|
|||
|
|
Next
|
|||
|
|
PutMayan(may$)
|
|||
|
|
EndProcedure
|
|||
|
|
|
|||
|
|
Repeat
|
|||
|
|
ConsoleLocate(0,0) : Print(LSet(" ",60))
|
|||
|
|
ConsoleLocate(0,0) : Print("MAYAN: ? ") : i$=Input()
|
|||
|
|
ClearConsole() : If i$="" : End : EndIf
|
|||
|
|
j$=Dec2Mayan(Val(i$)) : MayanNumerals(j$)
|
|||
|
|
ConsoleLocate(0,#START_Y+7) : Print("Dezimal = "+i$)
|
|||
|
|
ConsoleLocate(0,#START_Y+8) : Print("Vigesimal= "+j$)
|
|||
|
|
ForEver
|