I made a showcase

I took some of the things I’ve created in the past and put them into one place. Then I made a tic-tac-toe game and today I just added a dots and boxes game. the games are neat.

contains:

  • a lion I built in 2008
  • a bunch of turrets that I made a couple years ago
  • a big icosphere I generated a couple years ago
  • the new user machine that I wrote last summer
  • the point-in-polygon raycasting algorithm for zone detection that I shared a few months ago
  • the mammoth tank I built a couple months ago
  • tic tac toe
  • dots and boxes
3 Likes

I just got rekt ;(

I’m really interested in how that boundary checker works. Would you be willing to share that?

yuss. I made a perfect tic tac toe bot that you can play against. It can play X or O and rotates the board randomly when it thinks so it doesn’t always just pick the same spot.

This is the logic for the perfect bots, in order:
1: If you can win, win
2: If you can block, block
3: (this gets run multiple times for the different orientations)

if turn=="X"then
	if		s=='--- --- ---'then return 1,1
	elseif		s=='XO- --- ---'then return 2,2
		elseif	s=='XO- -X- --O'then return 3,1
	elseif		s=='X-O --- ---'then return 3,1
		elseif	s=='X-O O-- X--'then return 3,3
	elseif 		s=='X-- O-- ---'then return 2,2
		elseif	s=='X-- OX- --O'then return 1,3
	elseif		s=='X-- -O- ---'then return 3,3
	elseif		s=='X-- --O ---'then return 2,2
	elseif		s=='X-- --- O--'then return 1,3
		elseif	s=='XOX --- O--'then return 3,3
	elseif		s=='X-- --- -O-'then return 2,2
	elseif		s=='X-- --- --O'then return 1,3
		elseif	s=='XOX --- --O'then return 3,1
	end
elseif turn=="O"then
	if		s=='X-- --- ---'then return 2,2
		elseif	s=='X-- -OX ---'then return 3,3
		elseif	s=='X-- -O- -X-'then return 3,3
		elseif	s=='X-- -O- --X'then return 3,2
	elseif		s=='-X- --- ---'then return 2,2
		elseif	s=='-X- XO- ---'then return 1,1
		elseif	s=='-X- -OX ---'then return 1,3
		elseif	s=='-X- -O- X--'then return 1,3
		elseif	s=='-X- -O- -X-'then return 2,3
		elseif	s=='-X- -O- --X'then return 1,1
	elseif		s=='--- -X- ---'then return 1,1
		elseif	s=='O-- -X- --X'then return 3,1
	end
end

4: Threaten 3 in a row (2 in a row or one and then an empty space and then another)
5: Move randomly (end the game, there’s nothing useful left to do)

The easy bot just skips step 3.

Now make an algorithm without hard coded strategies for a variable N by M board size when you win when you have X in a row, that creates a game tree and then chooses the option that will provide the best results :smiley:? And maybe alpha-beta pruning if for some reason you have a game space that is too large (probably not). Difficulty of the bot is related to the maximum depth of the game tree and the probability for it to make a random move (to not pick the best strategy)


That would have to be for the dots and boxes game. Tic-tac-toe is already solved 3 moves ahead when the default response is to win or block. Dots and boxes has way more possible branches.

added easy and hard bots for dots and boxes. the easy one moves randomly and captures any squares that can be captured. the hard one doesn’t make any 3-sided boxes until there are no other moves left.

I made a three-player version of dots and boxes. The order is red, green, blue. They wait .2 seconds before moving. The first player gets to pick which players are bots. You can make all of them bots and the game goes fast.

Really awesome showcase! The tic-tac-toe game is what really caught my eye. Keep up the good work!

Ended up staying for 15 minutes playing tic tac toe but didn’t win or loose a single game ):

That lion looks like the old Lego creator one. Is that the case?

That is the case.

1 Like

You will not win if you play the perfect bots. You will not lose if you also play perfectly. You will win if you play perfectly against the easy bots (or against a human who does not play perfectly.)

updated the hard dots and boxes bot so it picks the shortest chain to move in if it is forced to make a move where you can capture.

just finished making a triangular dots and boxes. ogm

complete a triangle to capture it and move again. same thing but with 3 sides and not 4.