## Word Clock

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
dodicat
Posts: 7918
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Word Clock

What time is it?
I think it might be Newcastle or darkest Yorkshire.
I have adjusted my code to include zero.
BasicCoder2
Posts: 3879
Joined: Jan 01, 2009 7:03
Location: Australia

### Re: Word Clock

Nice one dodi. I didn't know that you could initialize an array the way you did in the intToRoman() function.
We can see why Roman numerals are not used in digital displays!
dodicat
Posts: 7918
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Word Clock

Thanks basiccoder2.
They had one of the world's biggest empires.
Just shows you that an efficient decimal numeral system is not all that important in the run of things.
neil
Posts: 338
Joined: Mar 17, 2022 23:26

### Re: Word Clock

Fibonacci Clock
This is my version of a Fibonacci clock.
This video explains how to read it.

Code: Select all

``````WindowTitle "Fibonacci Clock"
Screenres 502,322,32
Dim As string key,t
Dim Shared As UByte r,g,b
Dim As UByte a1,b1,c1,d1,a2,b2,c2,d2,hrs,min

sub Two()
line (10,10)-(130,130),rgb(r,g,b),bf
End sub

sub OneA()
line (139,10)-(195,66),rgb(r,g,b),bf
End Sub

Sub OneB()
line (139,75)-(195,130),rgb(r,g,b),bf
End Sub

Sub Three()
line (10,139)-(195,310),rgb(r,g,b),bf
End Sub

Sub Five()
line (204,10)-(491,310),rgb(r,g,b),bf
End Sub

Sub Zero()
line (10,10)-(130,130),rgb(255,255,255),bf
line (10,139)-(195,310),rgb(255,255,255),bf
line (139,10)-(195,66),rgb(255,255,255),bf
line (139,75)-(195,130),rgb(255,255,255),bf
line (204,10)-(491,310),rgb(255,255,255),bf
End Sub

Sub Red()
r = 255:g = 0:b = 0
End Sub

Sub Grn()
r = 0:g = 255:b = 0
End Sub

Sub Blu()
r = 0:g = 0:b = 255
End Sub

Do

t = time

hrs = val(left(t,2)):min = val(mid(t,4,2))
If hrs > 12 Then hrs -= 12
If hrs = 0 Then hrs += 12

a1 = 0:b1 = 0:c1 = 0:d1 = 0
a2 = 0:b2 = 0:c2 = 0:d2 = 0

Screenlock
Cls

zero

If hrs = 1 THEN a1 = 1:red:oneB
If hrs = 2 THEN a1 = 2:red:two
If hrs = 3 THEN a1 = 3:red:three
If hrs = 4 THEN a1 = 1:b1 = 3:red:oneB:three
If hrs = 5 THEN a1 = 5:red:five
If hrs = 6 THEN a1 = 1:b1 = 5:red:five:oneB
If hrs = 7 THEN a1 = 2:b1 = 5:red:two:five
If hrs = 8 THEN a1 = 3:b1 = 5:red:three:five
If hrs = 9 THEN a1 = 1:b1 = 3:c1 = 5:red:oneB:three:five
If hrs = 10 THEN a1 = 2:b1 = 3:c1 = 5:red:two:three:five
If hrs = 11 THEN a1 = 2:b1 = 3:c1 = 5:d1 = 1:red:two:three:five:oneB

If min > 4 and min < 10 Then a2 = 1:grn:oneA
If min > 9 and min < 15 Then a2 = 2:grn:two
If min > 14 and min < 20 Then a2 = 3:grn:three
If min > 19 and min < 25 Then a2 = 1:b2 = 3:grn:three:oneA
If min > 24 and min < 30 Then a2 = 5:grn:five
If min > 29 and min < 35 Then a2 = 1:b2 = 5:grn:oneA:five
If min > 34 and min < 40 Then a2 = 2:b2 = 5:grn:two:five
If min > 39 and min < 45 Then a2 = 3:b2 = 5:grn:three:five
If min > 44 and min < 50 Then a2 = 1:b2 = 3:c2 = 5:grn:oneA:three:five
If min > 49 and min < 55 Then a2 = 2:b2 = 3:c2 = 5:grn:two:three:five
If min > 54 Then a2 = 2:b2 = 3:c2 = 5:d2 = 1:grn:two:three:five:oneA

if a1 = 2 and a2 = 2 Then blu:two
if a1 = 3 and a2 = 3 Then blu:three
if a1 = 3 and b2 = 3 Then blu:three
if b1 = 3 and b2 = 3 Then blu:three
if b1 = 3 and a2 = 3 Then blu:three

if a1 = 5 and a2 = 5 Then blu:five
if a1 = 5 and b2 = 5 Then blu:five
if a1 = 5 and c2 = 5 Then blu:five
if a2 = 5 and c1 = 5 Then blu:five

if b1 = 5 and b2 = 5 Then blu:five
if b1 = 5 and c2 = 5 Then blu:five
if b1 = 5 and a2 = 5 Then blu:five
if b2 = 5 and c1 = 5 Then blu:five
if c1 = 5 and c2 = 5 Then blu:five

Screenunlock
key = inkey
sleep 100,1
Loop Until (key = Chr(27)) Or (key = Chr(255) & "k")``````
This Clock has been updated.
Last edited by neil on Jun 08, 2023 9:55, edited 2 times in total.
neil
Posts: 338
Joined: Mar 17, 2022 23:26

### Re: Word Clock

This explains more on how to read the Fibonacci clock.
https://mathsbot.com/puzzles/fibonacciClock

Here's a base4 clock.
neil
Posts: 338
Joined: Mar 17, 2022 23:26

### Re: Word Clock

Here's a 24-hour Kaktovic numeral clock. It's in two files. It uses an include. The clock outputs Kaktovic numerals in base 20
Numbers 20 = 1, 0---30 = 1, 10---40 = 2, 0---50 = 2, 10.

Code: Select all

``````#include "inupiaqfont.bi"

WindowTitle "Kaktovic Numeral Clock"
Dim As uByte hrs,min,sec
Dim As String key,t

Do
t = time
hrs = val(left(t,2))
min = val(mid(t,4,2))
sec = val(right(t,2))

Screenlock
Cls

if hrs = 0 Then put(40,20),fnt0
if hrs = 1 Then put(40,20),fnt1
if hrs = 2 Then put(40,20),fnt2
if hrs = 3 Then put(40,20),fnt3
if hrs = 4 Then put(40,20),fnt4
if hrs = 5 Then put(40,20),fnt5
if hrs = 6 Then put(40,20),fnt6
if hrs = 7 Then put(40,20),fnt7
if hrs = 8 Then put(40,20),fnt8

if hrs = 9 Then put(40,20),fnt9
if hrs = 10 Then put(40,20),fnt10
if hrs = 11 Then put(40,20),fnt11
if hrs = 12 Then  put(40,20),fnt12
if hrs = 13 Then  put(40,20),fnt13
if hrs = 14 Then put(40,20),fnt14
if hrs = 15 Then put(40,20),fnt15
if hrs = 16 Then put(40,20),fnt16
if hrs = 17 Then put(40,20),fnt17
if hrs = 18 Then put(40,20),fnt18
if hrs = 19 Then put(40,20),fnt19
if hrs = 20 Then put(40,20),fnt1:put(64,20),fnt0
if hrs = 21 Then put(40,20),fnt1:put(64,20),fnt1
if hrs = 22  Then put(40,20),fnt1::put(64,20),fnt2
if hrs = 23  Then put(40,20),fnt1:put(64,20),fnt3

if min = 0 Then put(110,20),fnt0
if min = 1 Then put(110,20),fnt1
if min = 2 Then put(110,20),fnt2
if min = 3 Then put(110,20),fnt3
if min = 4 Then put(110,20),fnt4
if min = 5 Then put(110,20),fnt5
if min = 6 Then put(110,20),fnt6
if min = 7 Then put(110,20),fnt7
if min = 8 Then put(110,20),fnt8

if min = 9 Then put(110,20),fnt9
if min = 10 Then put(110,20),fnt10
if min = 11 Then put(110,20),fnt11
if min = 12 Then put(110,20),fnt12
if min = 13 Then put(110,20),fnt13
if min = 14 Then put(110,20),fnt14
if min = 15 Then put(110,20),fnt15
if min = 16 Then put(110,20),fnt16
if min = 17 Then put(110,20),fnt17
if min = 18 Then put(110,20),fnt18
if min = 19 Then put(110,20),fnt19

if min = 20 Then put(110,20),fnt1:put(134,20),fnt0
if min = 21 Then put(110,20),fnt1:put(134,20),fnt1
if min = 22 Then put(110,20),fnt1::put(134,20),fnt2
if min = 23 Then put(110,20),fnt1:put(134,20),fnt3

if min = 24 Then put(110,20),fnt1:put(134,20),fnt4
if min = 25 Then put(110,20),fnt1:put(134,20),fnt5
if min = 26 Then put(110,20),fnt1::put(134,20),fnt6
if min = 27 Then put(110,20),fnt1:put(134,20),fnt7

if min = 28 Then put(110,20),fnt1:put(134,20),fnt8
if min = 29 Then put(110,20),fnt1:put(134,20),fnt9
if min = 30 Then put(110,20),fnt1::put(134,20),fnt10
if min = 31 Then put(110,20),fnt1:put(134,20),fnt11
if min = 32 Then put(110,20),fnt1::put(134,20),fnt12
if min = 33 Then put(110,20),fnt1:put(134,20),fnt13
if min = 34 Then put(110,20),fnt1::put(134,20),fnt14
if min = 35 Then put(110,20),fnt1:put(134,20),fnt15
if min = 36 Then put(110,20),fnt1::put(134,20),fnt16
if min = 37 Then put(110,20),fnt1:put(134,20),fnt17
if min = 38 Then put(110,20),fnt1::put(134,20),fnt18
if min = 39 Then put(110,20),fnt1:put(134,20),fnt19
if min = 40 Then put(110,20),fnt2::put(134,20),fnt0
if min = 41 Then put(110,20),fnt2:put(134,20),fnt1
if min = 42 Then put(110,20),fnt2::put(134,20),fnt2
if min = 43 Then put(110,20),fnt2:put(134,20),fnt3
if min = 44 Then put(110,20),fnt2::put(134,20),fnt4
if min = 45 Then put(110,20),fnt2:put(134,20),fnt5
if min = 46 Then put(110,20),fnt2::put(134,20),fnt6
if min = 47 Then put(110,20),fnt2:put(134,20),fnt7
if min = 48 Then put(110,20),fnt2::put(134,20),fnt8
if min = 49 Then put(110,20),fnt2:put(134,20),fnt9
if min = 50 Then put(110,20),fnt2::put(134,20),fnt10
if min = 51 Then put(110,20),fnt2:put(134,20),fnt11
if min = 52 Then put(110,20),fnt2::put(134,20),fnt12
if min = 53 Then put(110,20),fnt2:put(134,20),fnt13
if min = 54 Then put(110,20),fnt2::put(134,20),fnt14
if min = 55 Then put(110,20),fnt2:put(134,20),fnt15
if min = 56 Then put(110,20),fnt2::put(134,20),fnt16
if min = 57 Then put(110,20),fnt2:put(134,20),fnt17
if min = 58 Then put(110,20),fnt2::put(134,20),fnt18
if min = 59 Then put(110,20),fnt2:put(134,20),fnt19

if sec = 0 Then put(180,20),fnt0
if sec = 1 Then put(180,20),fnt1
if sec = 2 Then put(180,20),fnt2
if sec = 3 Then put(180,20),fnt3
if sec = 4 Then put(180,20),fnt4
if sec = 5 Then put(180,20),fnt5
if sec = 6 Then put(180,20),fnt6
if sec = 7 Then put(180,20),fnt7
if sec = 8 Then put(180,20),fnt8

if sec = 9 Then put(180,20),fnt9
if sec = 10 Then put(180,20),fnt10
if sec = 11 Then put(180,20),fnt11
if sec = 12 Then put(180,20),fnt12
if sec = 13 Then put(180,20),fnt13
if sec = 14 Then put(180,20),fnt14
if sec = 15 Then put(180,20),fnt15
if sec = 16 Then put(180,20),fnt16
if sec = 17 Then put(180,20),fnt17
if sec = 18 Then put(180,20),fnt18
if sec = 19 Then put(180,20),fnt19

if sec = 20 Then put(180,20),fnt1:put(204,20),fnt0
if sec = 21 Then put(180,20),fnt1:put(204,20),fnt1
if sec = 22 Then put(180,20),fnt1::put(204,20),fnt2
if sec = 23 Then put(180,20),fnt1:put(204,20),fnt3

if sec = 24 Then put(180,20),fnt1:put(204,20),fnt4
if sec = 25 Then put(180,20),fnt1:put(204,20),fnt5
if sec = 26 Then put(180,20),fnt1::put(204,20),fnt6
if sec = 27 Then put(180,20),fnt1:put(204,20),fnt7

if sec = 28 Then put(180,20),fnt1:put(204,20),fnt8
if sec = 29 Then put(180,20),fnt1:put(204,20),fnt9
if sec = 30 Then put(180,20),fnt1::put(204,20),fnt10
if sec = 31 Then put(180,20),fnt1:put(204,20),fnt11
if sec = 32 Then put(180,20),fnt1::put(204,20),fnt12
if sec = 33 Then put(180,20),fnt1:put(204,20),fnt13
if sec = 34 Then put(180,20),fnt1::put(204,20),fnt14
if sec = 35 Then put(180,20),fnt1:put(204,20),fnt15
if sec = 36 Then put(180,20),fnt1::put(204,20),fnt16
if sec = 37 Then put(180,20),fnt1:put(204,20),fnt17
if sec = 38 Then put(180,20),fnt1::put(204,20),fnt18
if sec = 39 Then put(180,20),fnt1:put(204,20),fnt19
if sec = 40 Then put(180,20),fnt2::put(204,20),fnt0
if sec = 41 Then put(180,20),fnt2:put(204,20),fnt1
if sec = 42 Then put(180,20),fnt2::put(204,20),fnt2
if sec = 43 Then put(180,20),fnt2:put(204,20),fnt3
if sec = 44 Then put(180,20),fnt2::put(204,20),fnt4
if sec = 45 Then put(180,20),fnt2:put(204,20),fnt5
if sec = 46 Then put(180,20),fnt2::put(204,20),fnt6
if sec = 47 Then put(180,20),fnt2:put(204,20),fnt7
if sec = 48 Then put(180,20),fnt2::put(204,20),fnt8
if sec = 49 Then put(180,20),fnt2:put(204,20),fnt9
if sec = 50 Then put(180,20),fnt2::put(204,20),fnt10
if sec = 51 Then put(180,20),fnt2:put(204,20),fnt11
if sec = 52 Then put(180,20),fnt2::put(204,20),fnt12
if sec = 53 Then put(180,20),fnt2:put(204,20),fnt13
if sec = 54 Then put(180,20),fnt2::put(204,20),fnt14
if sec = 55 Then put(180,20),fnt2:put(204,20),fnt15
if sec = 56 Then put(180,20),fnt2::put(204,20),fnt16
if sec = 57 Then put(180,20),fnt2:put(204,20),fnt17
if sec = 58 Then put(180,20),fnt2::put(204,20),fnt18
if sec = 59 Then put(180,20),fnt2:put(204,20),fnt19
Screenunlock
key = inkey
sleep 100,1
Loop Until (key = Chr(27)) Or (key = Chr(255) & "k")

imagedestroy fnt0:imagedestroy fnt1:imagedestroy fnt2
imagedestroy fnt3:imagedestroy fnt4:imagedestroy fnt5
imagedestroy fnt6:imagedestroy fnt7:imagedestroy fnt8
imagedestroy fnt9:imagedestroy fnt10:imagedestroy fnt11
imagedestroy fnt12:imagedestroy fnt13:imagedestroy fnt14
imagedestroy fnt15:imagedestroy fnt16:imagedestroy fnt17
imagedestroy fnt18:imagedestroy fnt19``````
Here's the Inupiaq font file.

Code: Select all

``````'inupiaqfont.bi

Dim As UByte b,i,n,nb,j,font
Dim As string s1,sa,sb
Dim As Ulong x,y
Screenres 268,80,32
Cls
Dim As Any pointer fnt0,fnt1,fnt2,fnt3,fnt4,fnt5,fnt6,fnt7,fnt8,fnt9,fnt10
Dim As Any pointer fnt11,fnt12,fnt13,fnt14,fnt15,fnt16,fnt17,fnt18,fnt19

fnt0 = ImageCreate(28,35,rgb(0,0,0)):fnt1 = ImageCreate(28,35,rgb(0,0,0)):fnt2 = ImageCreate(28,35,rgb(0,0,0))
fnt3 = ImageCreate(28,35,rgb(0,0,0)):fnt4 = ImageCreate(28,35,rgb(0,0,0)):fnt5 = ImageCreate(28,35,rgb(0,0,0))
fnt6 = ImageCreate(28,35,rgb(0,0,0)):fnt7 = ImageCreate(28,35,rgb(0,0,0)):fnt8 = ImageCreate(28,35,rgb(0,0,0))
fnt9 = ImageCreate(28,35,rgb(0,0,0)):fnt10 = ImageCreate(28,35,rgb(0,0,0)):fnt11 = ImageCreate(28,35,rgb(0,0,0))
fnt12 = ImageCreate(28,35,rgb(0,0,0)):fnt13 = ImageCreate(28,35,rgb(0,0,0)):fnt14 = ImageCreate(28,35,rgb(0,0,0))
fnt15 = ImageCreate(28,35,rgb(0,0,0)):fnt16 = ImageCreate(28,35,rgb(0,0,0)):fnt17 = ImageCreate(28,35,rgb(0,0,0))
fnt18 = ImageCreate(28,35,rgb(0,0,0)):fnt19 = ImageCreate(28,35,rgb(0,0,0))

for font = 0 to 19

x = 2:y = 2
nb = 1

for n = 1 to 31
for i = nb to nb + 5 step 2
sa = mid(s1,i,2)
b = val("&H"+ sa)
sb = bin(b,8)

for j = 1 to 8

if mid(sb,j,1) = "1" and font = 0 Then pset fnt0,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 0 Then pset fnt0,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 1 Then pset fnt1,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 1 Then pset fnt1,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 2 Then pset fnt2,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 2 Then pset fnt2,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 3 Then pset fnt3,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 3 Then pset fnt3,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 4 Then pset fnt4,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 4 Then pset fnt4,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 5 Then pset fnt5,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 5 Then pset fnt5,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 6 Then pset fnt6,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 6 Then pset fnt6,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 7 Then pset fnt7,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 7 Then pset fnt7,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 8 Then pset fnt8,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 8 Then pset fnt8,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 9 Then pset fnt9,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 9 Then pset fnt9,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 10 Then pset fnt10,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 10 Then pset fnt10,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 11 Then pset fnt11,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 11 Then pset fnt11,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 12 Then pset fnt12,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 12 Then pset fnt12,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 13 Then pset fnt13,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 13 Then pset fnt13,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 14 Then pset fnt14,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 14 Then pset fnt14,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 15 Then pset fnt15,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 15 Then pset fnt15,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 16 Then pset fnt16,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 16 Then pset fnt16,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 17 Then pset fnt17,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 17 Then pset fnt17,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 18 Then pset fnt18,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 18 Then pset fnt18,(x,y),rgb(0,0,0)
if mid(sb,j,1) = "1" and font = 19 Then pset fnt19,(x,y),rgb(0,255,225)
if mid(sb,j,1) = "0" and font = 19 Then pset fnt19,(x,y),rgb(0,0,0)
x += 1
next

if x >= 26 Then x = 2:y += 1
next
nb += 6
if n = 11 or n = 22 Then read s1:nb = 1
next
next

'put(10,10),fnt0:put(50,10),fnt1:put(90,10),fnt2:put(130,10),fnt3
'put(170,10),fnt4:put(210,10),fnt5:put(250,10),fnt6:put(290,10),fnt7
'put(330,10),fnt8:put(370,10),fnt9

'put(10,60),fnt10:put(50,60),fnt11:put(90,60),fnt12:put(130,60),fnt13
'put(170,60),fnt14:put(210,60),fnt15:put(250,60),fnt16:put(290,60),fnt17
'put(330,60),fnt18:put(370,60),fnt19
'sleep

'0
data "00000038003C3F81FE3FF7FC1FFFF001FF8000FF8001FFC003E3E007C1E00780F0"
data "0F00F00F00700E00700E00700F00700F00F00780F007C3E003FFC001FFC0007F00"
data "000000000000000000000000000000000000000000000000000000"
'1
data "3800003C00003C00001E00001E00000F000007800007800003C00003E00001E000"
data "00F00000F000007800003C00003C00001E00001F00000F000007800007800003C0"
data "0001E00001E00000F00000F800007800003C00003C00001C000000"
'2
data "38001C38001C3C003C3C003C3C00381E00781E00781E00700E00F00F00F00F00E0"
data "0701E00781E00781E00383C003C3C003C3C001C38001E78001E78000E70000FF00"
data "00FF0000FE00007E00007E00007C00003C00003C00003800000000"
'3
data "3807003807803807803C0F803C0F803C0F801C0FC01C0FC01E1FC01E1FC01E1FC0"
data "0E1DE00F1DE00F3DE00F3CE0073CF00738F007B8F007F8F007F87003F87803F078"
data "03F07803F03803F03801F03C01E03C01E03C01E01C00E01C000000"
'4
data "38381C383C1C383C3C3C3C3C3C3C3C3C7C3C3C7E381C7E381C7E381C7E781E7E78"
data "1E7E781EFE700EFF700EFF700FFFF00FEFF00FE7F00FE7F00FE7E007E7E007E7E0"
data "07C7E007C3E007C3E007C3C003C3C003C3C00383C00381C0000000"
'5
data "0000FC001FFC03FFFC3FFFE03FFC003F8000000000000000000000000000000000"
data "000000000000000000000000000000000000000000000000000000000000000000"
data "000000000000000000000000000000000000000000000000000000"
'6
data "0000FC001FFC03FFFC3FFFE03FFC003F80003E00001F00000F000007800007C000"
data "03C00001E00001F00000F800007800003C00003E00001E00000F00000F800007C0"
data "0003C00001E00001F00000F000007800007C00003C00001C000000"
'7
data "0000FC001FFC03FFFC3FFFE03FFC003F80003C00083C001C1E003C1E003C0E0038"
data "0F00780F00780700F00780F00781E00381E003C1C003C3C001E3C001E78001E780"
data "00F70000FF00007F00007E00007E00003C00003C00003800000000"
'8
data "0000FC001FFC03FFFC3FFFE03FFC003F80003C02003C07003C07801C07801E0F80"
data "1E0F801E0FC00E1FC00F1FC00F1FE00F1DE0073DE007BCE007B8F007F8F003F870"
data "03F87803F07803F07801F03801F03C01E03C01E01C00E01C000000"
'9
data "0000FC001FFC03FFFC3FFFE03FFC003F80003C00083C3C1C3C3C1C3C3C3C1C3C3C"
data "1C7C3C1E7E381E7E781E7E780E7E780EFE700EFF700FFFF00FEFF00FE7F007E7E0"
data "07E7E007E7E007C7E007C3E007C3C003C3C003C3C00381C0000000"
'10
data "3F00003FF8003FFFC007FFFC003FFC00FFFC1FFFF83FFF003FE0003C0000000000"
data "000000000000000000000000000000000000000000000000000000000000000000"
data "000000000000000000000000000000000000000000000000000000"
'11
data "3F00003FF8003FFFC007FFFC003FFC00FFFC1FFFF83FFF003FE0003E00001F0000"
data "0F000007800003C00003E00001F00000F800007800003C00001E00001F00000F80"
data "0007C00003C00001E00000F00000F800007C00003C00001C000000"
'12
data "3F00003FF8003FFFC007FFFC003FFC00FFFC1FFFF83FFF003FE0003C00003C001C"
data "1E003C1E003C0F00780F00780700F00780F00781E003C1E003C3C001C3C001E780"
data "01E78000FF0000FF00007E00007E00003C00003C00003800000000"
'13
data "3F00003FF8003FFFC007FFFC003FFC00FFFC1FFFF83FFF003FE0003C00003C0700"
data "3C07801C07801E0F801E0FC00E0FC00F1FC00F1FE00F1DE0073DE007BCF007F8F0"
data "03F87003F87803F07803F03801F03C01E03C01E01C00E01C000000"
'14
data "3F00003FF8003FFFC007FFFC003FFC00FFFC1FFFF83FFF003FE0003C00003C181C"
data "3C3C1C3C3C3C1C3C3C1E7C3C1E7E381E7E780E7E780EFE780FFF700FFFF00FE7F0"
data "07E7F007E7E007C7E007C3E007C3E003C3C00383C00381C0000000"
'15
data "0000FC001FFC03FFFC3FFFE03FFC003FFF001FFFF800FFFC003FFC07FFFC3FFFC0"
data "3FF8003F0000000000000000000000000000000000000000000000000000000000"
data "000000000000000000000000000000000000000000000000000000"
'16
data "0000FC001FFC03FFFC3FFFE03FFC003FFF001FFFF800FFFC003FFC07FFFC3FFFC0"
data "3FF8003F00001F00000F800007C00003E00001F00000F800007C00003E00001F00"
data "000F800007C00003E00001F00000F800007C00003C00001C000000"
'17
data "0000FC001FFC03FFFC3FFFE03FFC003FFF001FFFF800FFFC003FFC07FFFC3FFFC0"
data "3FF8003F00003C00081E001C1E003C0F007C0F00780780F00780F003C1E003C3C0"
data "01E3C001E78000FF8000FF00007E00007E00003C00003800000000"
'18
data "0000FC001FFC03FFFC3FFFE03FFC003FFF001FFFF800FFFC003FFC07FFFC3FFFC0"
data "3FF8003F00003C03001C07001E07801E0F800E0FC00F1FC00F1FE0071DE007BCE0"
data "07BCF003F8F003F87803F07801F03801E03C01E03C00E01C000000"
'19
data "0000FC001FFC03FFFC3FFFE03FFC003FFF001FFFF800FFFC003FFC07FFFC3FFFC0"
data "3FF8003F00003C18083C3C1C1C3C3C1C3C3C1E7E3C1E7E780E7E780EFF780FFF70"
data "0FEFF007E7F007E7E007C7E007C3E003C3C003C3C00381C0000000"``````
Last edited by neil on Jun 16, 2023 7:22, edited 1 time in total.
neil
Posts: 338
Joined: Mar 17, 2022 23:26

### Re: Word Clock

I updated the Kaktovic numeral clock. I found errors in my code.
hhr
Posts: 164
Joined: Nov 29, 2019 10:41

### Re: Word Clock

Very nice, I have learned something new.
dodicat
Posts: 7918
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Word Clock

Looks cool Neil.
The number system looks very logical, 0 is the oddball, coming in groups of five with an extra line added for each digit.
If you have connections with these Alaskans then I wish you well in this changing world.
I was reading in the another forum that the built in c runtime in some Linux distros has changed a bit.
You could test with this, changing to and back from number bases up to 36.
I have picked out 2,8,16 and 20.

Code: Select all

``````
#include "crt.bi"
Declare Function _ulltoa  Cdecl Alias "ulltoa"(Byval As Ulongint, Byval As zstring Ptr, Byval As Long) As zstring Ptr

Function ULongToBase(N As Ulongint,_base As Byte) As String
Dim As zstring * 70 buffer
_ulltoa(n,@buffer,_base)
Return Ucase(buffer)
End Function

Function ULongFromBase(N As String,_base As Byte) As Ulongint
Return strtoull(n,0,_base)
End Function

Dim As String b
Dim As Ulongint u=123455789
Dim As Long bases(1 To 4)={2,8,16,20}
Print "number"
Print u
Print
For n As Long=Lbound(bases) To Ubound(bases)
Select Case bases(n)
Case 2
print "base ";bases(n)
b= Ulongtobase(u,2)
Print b
Print Bin(u)
Print Ulongfrombase(b,2)
Print "____"
Case 8
print "base ";bases(n)
b= Ulongtobase(u,8)
Print b
Print Oct(u)
Print Ulongfrombase(b,8)
Print "____"
Case 16
print "base ";bases(n)
b= Ulongtobase(u,16)
Print b
Print Hex(u)
Print Ulongfrombase(b,16)
Print "____"
Case 20
print "base ";bases(n)
b= Ulongtobase(u,20)
Print b
'print bin(u)
Print Ulongfrombase(b,20)
Print "____"
End Select
Next n
Sleep ``````
dafhi
Posts: 1618
Joined: Jun 04, 2005 9:51

### Re: Word Clock

@dodicat
MX Linux wrote:

Code: Select all

``````ld: test.o: in function `ULONGTOBASE':
test.c:(.text+0x75): undefined reference to `ulltoa'``````
neil
Posts: 338
Joined: Mar 17, 2022 23:26

### Re: Word Clock

@dodicat
The Linux console wrote.
/usr/bin/../bin/ld: base.o: in function `ULONGTOBASE':
base.c:(.text+0xa7): undefined reference to `ulltoa'

It tested OK on Windows 10.
dodicat
Posts: 7918
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Word Clock

Thanks neil.
Actually there was no need for me to declare function _ulltoa . . .
It is already done in crt.bi(in windows anyway)
line ~~7
ulltoa(n,@buffer,_base)
is OK for ulongint numbers.
dafhi
Posts: 1618
Joined: Jun 04, 2005 9:51

### Re: Word Clock

after i commented out line 7
segfault

Code: Select all

``````#include "crt.bi"
Declare Function _ulltoa  Cdecl Alias "ulltoa"(Byval As Ulongint, Byval As zstring Ptr, Byval As Long) As zstring Ptr

Function ULongToBase(N As Ulongint,_base As Byte) As String
Dim As zstring * 70 buffer
'      _ulltoa(n,@buffer,_base)
Return Ucase(buffer)
End Function

Function ULongFromBase(N As String,_base As Byte) As Ulongint
Return strtoull(n,0,_base)
End Function

namespace printbase

Dim As String b
Dim As Ulongint u=123455789
Dim As Long bases(1 To 4)={2,8,16,20}
sub do_it_now( n as long )
print "base ";n
b= Ulongtobase(u,n)
Print b
Print Bin(u)
'  Print Ulongfrombase(b,n) '' segfault
Print "____"
end sub

end namespace

using printbase
Print "number"
Print u
Print
For n As Long=Lbound(bases) To Ubound(bases)
printbase.do_it_now bases(n)
Next n
Sleep
``````
neil
Posts: 338
Joined: Mar 17, 2022 23:26

### Re: Word Clock

After I commented out line 7.
number
123455789

base 2

111010110111100100100101101
Segmentation fault
neil
Posts: 338
Joined: Mar 17, 2022 23:26

### Re: Word Clock

@dodicat
I am getting a Segmentation fault now.
This is after it outputs base2 binary.
I updated the previous results.