Never heard about that game, interesting gameplay.
I won against the "1 Star" and "2 Stars" AI in around 50 turns.
The sliding stone animations made it easy to follow what was happening.
Small random notes:
1) There should be some small display whose turn it is and what color you play.
2) In the rules it says: "Playing stones can also be shuffled randomly in any part"
But 'shuffle' actually starts a new game with random placement, the previous game is lost. That was not what I had expected.
3) The rules text could be a bit more precise.
"The aim of the game is to control the centre of the board.
The first player to control the center square with the crown wins."
That was not immediately clear to me, maybe because both sentences uses the word "control" but it is unclear what "control" means.
Maybe rewrite second sentence as:
"The first player to place one of his stones on the center square with the crown wins."
On the code:
1) math.randomseed(184)
You can use the current time for random seed, to get a new seed every time.
2) Holy batman, those are LOTS of two-letter variables!
3) function ohodnoceni() is 10.000 lines! Wow!
4) There are many parts that repeat with small variations and many big, long if-blocks. Stuff like:
Code: Select all
...
--4
if vx1 < 9 and vy1 < 8 then
if not(vx1+1==5 and vy1+2==2) and not(vx1+1==4 and vy1+2==3) and not(vx1+1==5 and vy1+2==3) and not(vx1+1==6 and vy1+2==3) and not(vx1+1==3 and vy1+2==4) and not(vx1+1==4 and vy1+2==4)
and not(vx1+1==5 and vy1+2==4) and not(vx1+1==6 and vy1+2==4) and not(vx1+1==7 and vy1+2==4) and not(vx1+1==2 and vy1+2==5) and not(vx1+1==3 and vy1+2==5) and not(vx1+1==4 and vy1+2==5)
and not(vx1+1==5 and vy1+2==5) and not(vx1+1==6 and vy1+2==5) and not(vx1+1==7 and vy1+2==5) and not(vx1+1==8 and vy1+2==5) and not(vx1+1==3 and vy1+2==6) and not(vx1+1==4 and vy1+2==6)
and not(vx1+1==5 and vy1+2==6) and not(vx1+1==6 and vy1+2==6) and not(vx1+1==7 and vy1+2==6) and not(vx1+1==4 and vy1+2==7) and not(vx1+1==5 and vy1+2==7) and not(vx1+1==6 and vy1+2==7)
and not(vx1+1==5 and vy1+2==8) then
if c[vx1+1][vy1+2] == 0 then
z[vx1+1][vy1+2] = 2
z_ai = z_ai + 1
end
end
end
--5
if vx1 > 1 and vy1 < 8 then
if not(vx1-1==5 and vy1+2==2) and not(vx1-1==4 and vy1+2==3) and not(vx1-1==5 and vy1+2==3) and not(vx1-1==6 and vy1+2==3) and not(vx1-1==3 and vy1+2==4) and not(vx1-1==4 and vy1+2==4)
and not(vx1-1==5 and vy1+2==4) and not(vx1-1==6 and vy1+2==4) and not(vx1-1==7 and vy1+2==4) and not(vx1-1==2 and vy1+2==5) and not(vx1-1==3 and vy1+2==5) and not(vx1-1==4 and vy1+2==5)
and not(vx1-1==5 and vy1+2==5) and not(vx1-1==6 and vy1+2==5) and not(vx1-1==7 and vy1+2==5) and not(vx1-1==8 and vy1+2==5) and not(vx1-1==3 and vy1+2==6) and not(vx1-1==4 and vy1+2==6)
and not(vx1-1==5 and vy1+2==6) and not(vx1-1==6 and vy1+2==6) and not(vx1-1==7 and vy1+2==6) and not(vx1-1==4 and vy1+2==7) and not(vx1-1==5 and vy1+2==7) and not(vx1-1==6 and vy1+2==7)
and not(vx1-1==5 and vy1+2==8) then
if c[vx1-1][vy1+2] == 0 then
z[vx1-1][vy1+2] = 2
z_ai = z_ai + 1
end
end
end
...
There is very likely a better, more compact way.
Maybe with loops?
Obviously you knew what you were doing because the game is functional and the AI plays well enough.
It is amazing actually
But it is also a bit scary. Did you not get crazy about typos? Or is that code auto-generated in some way?
In another thread I wrote yesterday "It does not matter how crude your code is, as long as the game gets completed." I still stand by that statement but you have taken it to the extreme.