Spinoff from the recent buttons thread (http://masm32.com/board/index.php?topic=10267.0): test the Click me now! button :cool:
I haven't downloaded it yet to check it out, I'm on my iPad. Does this mean you found a solution? Or did you opt for a different method?
Looks okay over here. Windows 7 64 bit OS.
Quote from: Swordfish on August 25, 2022, 10:27:12 AM
I haven't downloaded it yet to check it out, I'm on my iPad. Does this mean you found a solution? Or did you opt for a different method?
I opted for a full ownerdraw, with FillRect, DrawText etc. It's not yet perfect but I'm working on it. Syntax:
GuiControl MyButton, "button", "Coloured pushbutton", font -16:FW_BOLD, fcol DarkBlue, bcol LiteYellow, y310, w300, h300, BS_OWNERDRAW
You may have noted that the window is sizeable:
y310 310/1000 of main window height
w300 300/1000 of main window width
h300 300/1000 of main window height
Cool. Glad you have gotten that all sorted out.
New version - to the left, the new button, to the right the old one.
Still work in progress, but I am getting nearer :badgrin:
In contrast to Swordfish (http://masm32.com/board/index.php?topic=10287.0), I have no game logic so far, this is just the graphics (and yes, this is the complete source :tongue:):
GuiParas equ "Tic Tac Toe", w172, h280, m4, b LitePink, icon Dice ; width+height, margins, background colour
include \masm32\MasmBasic\Res\MbGui.asm
rct=0
Repeat 3 ; variable+fixed parts
GuiControl @CatStr(<ttt>, %rct+0), "button", x000, y rct*111+1, h333, w333, bcol LiteYellow, font -32:FW_BOLD
GuiControl @CatStr(<ttt>, %rct+1), "button", x333, y rct*111+1, h333, w333, bcol LiteGreen, font -32:FW_BOLD
GuiControl @CatStr(<ttt>, %rct+2), "button", x666, y rct*111+1, h333, w333, bcol LiteBlue, font -32:FW_BOLD
rct=rct+3
Endm
GuiControl MyStatus, "statusbar", wRec$(Str$("Last ID=%i, common controls version ", %IdCt)+ComCtl32$())
Event Key
.if VKey==-VK_ESCAPE
invoke SendMessage, hGui, WM_CLOSE, 0, 0
.endif
Event Command
If_ nCode==BN_CLICKED Then SetWin$ <rv(GetDlgItem, hGui, MenuID)>="X"
GuiEnd
For the game logic (AI lol)
Test for winning move first. If found, take it
Next test for blocking move, if found take it. Sometimes more than one though, in that case computer will lose.
If none of those are found test the center square, take it.
Else a random move.
daydreamer is also contemplating a tic tac toe game
We should have each other's AI play against each other. lol
Quote from: Swordfish on August 30, 2022, 06:55:30 AMWe should have each other's AI play against each other. lol
One day - right now, I've too many unfinished projects :sad:
Rumour has it that you are King in that regard
Yeah, that's true :biggrin:
I am just playing around :cool:
Btw this is Win7-64, on Win10 the fish looks different. I also wonder why it remains black & white on Win10 :sad:
(https://jj2007.eu/pics/TicTacToe.png)
I don't know if it will be fun, but it looks fun(ny).
Where's the X and O? :biggrin:
I'll look at it later...
It still looks as above, but now the logic is implemented. Still with little glitches, but one can play the game :cool:
Version 3, almost perfect, and no font problems :cool:
Version 4 has a manual mode: type m
If manual mode is on, Shift click plays for the software. This is basically for verifying if there are better moves than what the software chooses for itself. For example:
P#1 P#2
r0c0 r2c2
r0c2 r0c1
r2c0 r1c0
r1c1 player won
Does anybody know a sequence that allows player #2 to win?
Quote from: jj2007 on September 02, 2022, 11:10:06 PM
Version 4 has a manual mode: type m
If manual mode is on, Shift click plays for the software. This is basically for verifying if there are better moves than what the software chooses for itself. For example:
P#1 P#2
r0c0 r2c2
r0c2 r0c1
r2c0 r1c0
r1c1 player won
Does anybody know a sequence that allows player #2 to win?
In reply #7 in this thread, I warned of scenarios like this. First player always has advantage regardless of second players logic or 'strength'. Better explanation in reply to your duplicate posting in campus - here (http://masm32.com/board/index.php?topic=10267.msg112875#msg112875)
Just took a look at your tic tac toe again playing with it. Apparently you didn't lock the players ability to move when the computer is 'thinking'. computers piece can be overwritten.