Author Topic: Simple Games - Research and Development  (Read 3481 times)

NoCforMe

  • Member
  • ****
  • Posts: 684
Re: Simple Games - Research and Development
« Reply #210 on: September 23, 2022, 09:46:30 AM »
Need to reply to your recent diatribe here.

Like Hutch said somewhere earlier, nobody gets to own threads here, you included. We're free to go off on tangents if we like.

I suggest you learn to just skip over what posts you're not interested in. Nobody's trying to slow you down. It's totally on you what you respond to or not. If you don't like it, just ignore it.

Sorry, not trying to beat up on you. We (I think I speak for the congregation here) like you and your projects and wish you success with them. But we do like to comment on stuff. That's the way fora* like this work.

Now back to sudoku.

* Fancy-schmancy plural of forum.

jj2007

  • Member
  • *****
  • Posts: 12964
  • Assembler is fun ;-)
    • MasmBasic
Re: Simple Games - Research and Development
« Reply #211 on: September 23, 2022, 09:50:47 AM »
We (I think I speak for the congregation here) like you and your projects and wish you success with them.

 :thumbsup:

zedd151

  • Member
  • *****
  • Posts: 1268
Simple Tic Tac Toe
« Reply #212 on: September 23, 2022, 04:58:59 PM »
Attached is a playable and 95% completed Tic Tac Toe game. It doesn't make random moves (or best choices) for the computers moves in this version. Once the board is full, or if a winning combination is detected game automatically resets after closing the message box that will pop up. Work will continue on this project at some time in the future.


See Simple TicTacToe for the final version
« Last Edit: September 28, 2022, 10:46:48 AM by zedd151 »
... :biggrin:

TimoVJL

  • Member
  • *****
  • Posts: 1112
Re: Simple Games - Research and Development
« Reply #213 on: September 23, 2022, 05:12:35 PM »
 :thumbsup:
May the source be with you

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Tic Tac Toe...
« Reply #214 on: September 23, 2022, 05:27:22 PM »
I finally found the time to make tic tac toe game playable and self resetting. Will clean up the code, replacing the long .if/.elseif chains with loops or other methods later. The AI I had originally used in a previous version had a nasty flaw in it. Once that is fixed, I will reintroduce it into the game to make it a little more challenging. Currently if the computer can't find a blocking move, he scans the board for the first empty square and claims it.
Not very exciting, but with the small additions made today it is at least continuously playable for those who need a time waster type of game for their amusement.  :biggrin: 

Also on the books for completion is my Four in a Row game. A "Connect 4" type game. Will have another look at it in the coming days.
« Last Edit: September 24, 2022, 06:33:33 AM by swordfish »
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Tic Tac Toe ...
« Reply #215 on: September 24, 2022, 06:11:29 AM »
Added a flag indicating whose turn it is.
This is so the player does not cheat and set two pieces during their turn.
Player cannot set a piece while it is the computers turn.


See Simple TicTacToe for the final version
« Last Edit: September 28, 2022, 10:47:21 AM by zedd151 »
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Tic Tac Toe ...
« Reply #216 on: September 24, 2022, 06:28:16 AM »
Another small change.
Gave the computer a little help. First he checks for a winning move, if found he takes it.
Then he checks for a blocking move, if found he takes it.
If neither are true he checks if the center square is empty, if empty he takes it.
Then he checks the remaining squares for an empty square, if found he takes it.

See Simple TicTacToe for the final version
« Last Edit: September 28, 2022, 10:47:58 AM by zedd151 »
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Tic Tac Toe ...
« Reply #217 on: September 24, 2022, 03:50:38 PM »
Gave the computer some randomness for a little unpredictability. Some of his moves there will be a 1 in 3 chance he will take a better move. We don't want the computer to be smarter than us. He needs to 'forget' sometimes.  :cool:


See Simple TicTacToe for the final version
« Last Edit: September 28, 2022, 10:48:33 AM by zedd151 »
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Tic Tac Toe ...
« Reply #218 on: September 24, 2022, 11:07:40 PM »
Before I continue with any further additions, today I will tidy up the code; reducing the huge .if/.elseif/.endif chains, using a table rather than hard coded offsets for computers moves, and a few other 'optimizations'. Also I found one instance where a winning position was labeled as a draw. That will need to be addressed first.
I will remove the computers randomness temporarily for ease in finding where this error is occurring. Probably a typo in the 'check win' part of the code... lemme get back to my computer to check that... another ipad post  :rolleyes:
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Tic Tac Toe...
« Reply #219 on: September 25, 2022, 02:04:35 AM »
I've been playing with the game from the last attachment above Tic Tac Toe 1c.zip, (I've played hundreds of games) but cannot reproduce the draw error described above in reply 218. I checked the code, it looks okay. I will just have to wait until this error creeps up again then record the position of each X and O to try to solve this mystery.
Separately I am reducing the clutter in WndProc...
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Tic Tac Toe...
« Reply #220 on: September 26, 2022, 03:59:52 AM »
Still no improper draw errors. Also I am reconfiguring how some of the functions operate to reduce the code a bit. This looks like it may take some time. I was hoping to have something ready to post today, but unrelated obstacles are preventing any work on Tic Tac Toe at least for a couple more hours. (My sister has me doing some yard work. lol)
« Last Edit: September 26, 2022, 07:25:55 AM by zedd151 »
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Games - Research and Development
« Reply #221 on: September 28, 2022, 08:45:36 AM »
My development work on tic tac toe is finished. See Simple TicTacToe for the final version. I will continue now with development of my sudoku game.  :biggrin:  Currently I am in the process of adding a checking algorithm to determine if a given number is valid for the selected cell. Stay tuned.  :cool:
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Games - Research and Development
« Reply #222 on: September 29, 2022, 08:21:47 PM »

Snippet from the post:
...One can
swap any two rows, columns, or numbers and still have a
solvable puzzle.
Actually, that's not entirely true. Arbitrarily swapping a pair of rows or columns will indeed produce invalid boxes thereby invalidating the puzzle. You can however swap a column of three boxes for another column of three boxes; or swap a row of three boxes for another row of three boxes. The boxes must remain intact. It has been years since you had worked on sudoku, so I assume you had forgotten a lot of the details. I should have mentioned the obvious flaw at the time that you wrote that post.
But I am writing some swapping code of my own at this time and I remembered that post. That is why I am commenting on it at this time. Also reversing all the rows and/or columns also works, as does rotating the board 90, 180 or 270 degrees. Obviously I am creating many puzzles from a single puzzle using these methods. Doing it this way allows to have a smaller set of embedded puzzles to give the player access to many times that.  :biggrin:
I currently have a little over 100 puzzles embedded in the current rendition of the game. When the user clicks on 'New Game' they will have the choice of easy, medium or hard. A game is randomly chosen from one of the three categories. Then it is scrambled/shuffled using the methods that ensure it remains solvable and valid. Will be posting this version once the coding and bug-checking is finished on the scrambling/shuffling functions and I have at least 1000 puzzles prepared for the game, which will be added to over time.

... :biggrin:

FORTRANS

  • Member
  • *****
  • Posts: 1190
Re: Simple Games - Research and Development
« Reply #223 on: September 29, 2022, 11:11:59 PM »
Hi,


Snippet from the post:
...One can
swap any two rows, columns, or numbers and still have a
solvable puzzle.
Actually, that's not entirely true. Arbitrarily swapping a pair of rows or columns will indeed produce invalid boxes thereby invalidating the puzzle. You can however swap a column of three boxes for another column of three boxes; or swap a row of three boxes for another row of three boxes. The boxes must remain intact. It has been years since you had worked on sudoku, so I assume you had forgotten a lot of the details. I should have mentioned the obvious flaw at the time that you wrote that post.

   Oops, you are correct.  But you can swap two rows in a triad of rows.  And
the same logic for columns.  And yes, about ten years since I wrote that code.

Cheers,

Steve N.

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Simple Games - Research and Development
« Reply #224 on: September 30, 2022, 12:09:04 AM »

   Oops, you are correct.  But you can swap two rows in a triad of rows.  And
the same logic for columns.  And yes, about ten years since I wrote that code.
You are correct this time. I hadn’t thought about that, was thinking about two arbitrarily selected columns or rows. You might be on to something, you just skipped a step (the triad part, where the rows or columns must contain parts of the same box) the first time. Now it makes more sense.
That's two more algos I can add to the swapping/scrambling repertoire. Thanks for the quick reply, and clarification.


Btw - the way I'll be storing the cache of games, the filled cells will be represented by anything but the digits 1-9. The digits will be decided at runtime using some form of pseudo random number generator.
... :biggrin: