Page 2 of 6
Re: Magic 4x4
Posted: Wed May 14, 2025 10:21 pm
by pjay
It was a black screen for me to, apart from the score - I managed 336 in the darkness...
Disabling autostretch (or the DPI awareness switch) resolved the issue; being able to see what I'm doing I managed to score... 258! I'm clearly better off with my eyes shut.
Nice, thanks for posting.
Re: Magic 4x4
Posted: Wed May 14, 2025 10:29 pm
by threedslider
@pjay : True for disabling the DPI they work on all version from 6.04 to 6.21 beta9 ! Thank you a lot

Re: Magic 4x4
Posted: Thu May 15, 2025 6:45 am
by dige
Score: 886
What kind of game is this? I played it purely intuitively without knowing what to do. I could watch myself play - crazy!

Re: Magic 4x4
Posted: Thu May 15, 2025 8:04 am
by #NULL
On linux something doesn't work with the GrabSprite(). When I use CreateSprite() instead, I can see the numbered squares:
(around line number ~51)
Code: Select all
For i=1 To 16
nb$=Str(nb)
;StartDrawing(ScreenOutput())
CreateSprite(i, zoom/4,zoom/4)
StartDrawing(SpriteOutput(i))
DrawingMode(1)
Box(0,0,zoom/4-1,zoom/4-1,RGB(188,188,188))
For y=4 To zoom/4-6
For x=4 To zoom/4-6
Plot(x,y,RGB(SPH(1,i)+Random(x/2),SPH(2,i)+Random(y/2),SPH(3,i)+Random((x+y)/3)))
Next
Next
DrawingFont(Police)
DrawText(zoom/8-TextWidth(nb$)/2,zoom/8-TextHeight(nb$)/2, nb$, RGB(255,255,255))
StopDrawing()
;GrabSprite(i,0,0,zoom/4,zoom/4)
nb*2
Next
At first I thought it's a font problem, but Arial actually worked for me. But maybe you have to try a different font on you system if you still can't see something:
(around line 19)
Code: Select all
Police = LoadFont(0, "ubuntu", 24);zoom/25)
Police2 = LoadFont(1, "terminal", zoom/70)
Police3 = LoadFont(2, "terminal", zoom/23)
Police4 = LoadFont(3, "terminal", zoom/12)
Debug IsFont(0)
Debug Police
Re: Magic 4x4
Posted: Thu May 15, 2025 8:12 am
by SPH
#NULL wrote: Thu May 15, 2025 8:04 am
On linux something doesn't work with the GrabSprite(). When I use CreateSprite() instead, I can see the numbered squares:
(around line number ~51)
Code: Select all
For i=1 To 16
nb$=Str(nb)
;StartDrawing(ScreenOutput())
CreateSprite(i, zoom/4,zoom/4)
StartDrawing(SpriteOutput(i))
DrawingMode(1)
Box(0,0,zoom/4-1,zoom/4-1,RGB(188,188,188))
For y=4 To zoom/4-6
For x=4 To zoom/4-6
Plot(x,y,RGB(SPH(1,i)+Random(x/2),SPH(2,i)+Random(y/2),SPH(3,i)+Random((x+y)/3)))
Next
Next
DrawingFont(Police)
DrawText(zoom/8-TextWidth(nb$)/2,zoom/8-TextHeight(nb$)/2, nb$, RGB(255,255,255))
StopDrawing()
;GrabSprite(i,0,0,zoom/4,zoom/4)
nb*2
Next
Thank you very much for this correction. If it's okay with everyone, I'll correct my code with your routines.
A quick question: what about the different DPIs despite your corrected code?
PS : i dont have Linux (because : windows rule)

Re: Magic 4x4
Posted: Thu May 15, 2025 9:35 am
by miso
Hmm, if it's not linux, but DPI problem, changing only line 17 to this might solve everything:
(openscreen should remain as it is)
Code: Select all
ExamineDesktops()
OpenWindow(0,0,0,DesktopUnscaledX(zoom),DesktopUnscaledY(zoom+zoom/10),"Magic 4x4",#PB_Window_ScreenCentered);|#PB_Window_SystemMenu)
If someone would be able to test this who had glitch, that would be also helpful as a learning experience for me.
Re: Magic 4x4
Posted: Thu May 15, 2025 10:17 am
by SPH
1000 exactly

Re: Magic 4x4
Posted: Thu May 15, 2025 11:27 am
by BarryG
I have no idea how to play this or what to do. The "instructions" on line 5 don't explain jack.
Re: Magic 4x4
Posted: Thu May 15, 2025 1:01 pm
by SPH
BarryG wrote: Thu May 15, 2025 11:27 am
I have no idea how to play this or what to do. The "instructions" on line 5 don't explain jack.
The goal of the game is to add two identical numbers by pressing them together using the arrow keys on your keyboard.
Escape to exit.
New version (1.1c) on post 1.
Re: Magic 4x4
Posted: Thu May 15, 2025 1:11 pm
by Mindphazer
BarryG wrote: Thu May 15, 2025 11:27 am
I have no idea how to play this or what to do. The "instructions" on line 5 don't explain jack.
It's just a reboot of 2048 game :
https://en.wikipedia.org/wiki/2048_(video_game)
viewtopic.php?p=445750#p445750
viewtopic.php?p=526522&hilit=2048+game#p526522
Re: Magic 4x4
Posted: Thu May 15, 2025 2:13 pm
by NicTheQuick
Version 1.1c works now. But I think there is a bug. If you move into a direction that does not change the field, there still will be added two new pieces. Therefore I think if there is a direction that does not change the field no new pieces should be added.
Btw. here's my first try:

Re: Magic 4x4
Posted: Thu May 15, 2025 3:28 pm
by SPH
NicTheQuick wrote: Thu May 15, 2025 2:13 pm
Version 1.1c works now. But I think there is a bug. If you move into a direction that does not change the field, there still will be added two new pieces. Therefore I think if there is a direction that does not change the field no new pieces should be added.
Are you sure it adds two pieces even if the chosen direction doesn't move any pieces?
I coded the game so that it only adds one piece. I'm sure of it. To convince yourself, take a screenshot before and after a turn and look closely...
By the way: I'm amazed by your score! GG
Re: Magic 4x4
Posted: Thu May 15, 2025 4:34 pm
by moulder61
@SPH
It works OK for me in Linux using PB6.11 LTS b2.
It adds a new number even if your key press doesn't actually move anything, but I'm not sure if that's a bug or a feature?
I could see it being useful tactically, occasionally.
Moulder.
Re: Magic 4x4
Posted: Thu May 15, 2025 5:28 pm
by NicTheQuick
SPH wrote: Thu May 15, 2025 3:28 pm
NicTheQuick wrote: Thu May 15, 2025 2:13 pm
Version 1.1c works now. But I think there is a bug. If you move into a direction that does not change the field, there still will be added two new pieces. Therefore I think if there is a direction that does not change the field no new pieces should be added.
Are you sure it adds two pieces even if the chosen direction doesn't move any pieces?
I coded the game so that it only adds one piece. I'm sure of it. To convince yourself, take a screenshot before and after a turn and look closely...
By the way: I'm amazed by your score! GG
Yes, sorry for that. The original one on a 5x5 grid usually adds 2 pieces. I just confused it with yours. Your code only adds one piece.
Re: Magic 4x4
Posted: Thu May 15, 2025 5:55 pm
by SPH
No problemo
