Score Four mini game

This forum is meant for announcing games (both under development and finished).

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Score Four mini game

Postby Lyberodoggy » Mon Sep 14, 2009 3:56 pm

That's the game I 've been talking about. Nothing too complicated, just a version of the popular game. You can have a beta sneak peak here: http://www.filefront.com/14530925/Score%20Four.exe



Features to add:
-better graphics
-instructions
-AI to play against
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Mon Sep 14, 2009 4:18 pm

Ah Doggy, very nice! :)

I'm actually working on a similar game as well. Here's the interface:

Image

It'll be interesting to compare the counting code you used to mine. How many directions does it count? Like up, down, across, diagonal?
Chromegloss - Vanishes and then re-appears at complete random. [Working on Advanced Section of VBScript guide]
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Mon Sep 14, 2009 6:05 pm

It checks for a wining four each round horizontally and vertically. I 'm trying to think of a way to implement diagonal checking without scraping my whole code...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby reneuend » Mon Sep 14, 2009 6:48 pm

I was working on a similar game called, "Khet". A complex laser game, where the laser beam can bounce horiz, vert, or diagonal depending on where you place a mirror. I've produced some very cool algorithms from this.

I have the code for checking diagnally at home (currently, I'm at work). Let me know if you would like to see it.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby Lyberodoggy » Mon Sep 14, 2009 7:11 pm

I figured out this one for diagonal checking but it works only downwards (you can't win if you have four beads ascending from left to right)

Code: Select all
column=((cell-1) mod 6)+1
row=(cell-1)\6+1
diagonal=((row-1)*6+column) mod 7


'check diagonally
for h=diagonal to diagonal+21 step 7
If celldata=ReadINI("Board.ini","status",h) then
same=same+1
If same=4 then exit for
Else
same=1
celldata=ReadINI("Board.ini","status",h)
End If
Next
If same=4 and celldata<>"" Then CheckFour=celldata
same=0
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Zenoc2 » Tue Sep 15, 2009 12:29 am

reneuend wrote:I was working on a similar game called, "Khet". A complex laser game, where the laser beam can bounce horiz, vert, or diagonal depending on where you place a mirror. I've produced some very cool algorithms from this.

I have the code for checking diagnally at home (currently, I'm at work). Let me know if you would like to see it.

You were making a PC version of Khet in AM? Cool! I've always wanted to play that game!
"What you want is irrelevant. What you have chosen is at hand." -Captain Spock

Proud member of the
Image

Image
User avatar
Zenoc2
Expert Member
 
Posts: 399
Joined: Mon Dec 01, 2008 10:26 pm
Location: Free Country, USA

Postby Chromegloss55 » Tue Sep 15, 2009 11:57 pm

The diagonal is more tricky.

I used very simple code (unfortunately it makes it more long-winded and convoluted) to check if a new horizontal and vertical connection has been made on that turn.

I need to adapt it for diagonal.

Code: Select all
Sub CheckConnected

i = HotspotNo
TagNeed = Hotspot(i).tag

' *** Check all horizontal connections
' *** Checks If H * * *

a = i + 1
b = i + 2
c = i + 3

If i > 46 then HorR1 = 1

If HorR1 = 0 Then If i = 5 or i = 6 or i = 7 then HorR1 = 1
If HorR1 = 0 Then If i = 12 or i = 13 or i = 14 then HorR1 = 1
If HorR1 = 0 Then If i = 19 or i = 20 or i = 21 then HorR1 = 1
If HorR1 = 0 Then If i = 26 or i = 27 or i = 28 then HorR1 = 1
If HorR1 = 0 Then If i = 33 or i = 34 or i = 35 then HorR1 = 1
If HorR1 = 0 Then If i = 40 or i = 41 or i = 42 then HorR1 = 1

If HorR1 = 0 Then If a = 6 or a = 7 or a = 8 then HorR1 = 1
If HorR1 = 0 Then If a = 13 or a = 14 or a = 15 then HorR1 = 1
If HorR1 = 0 Then If a = 20 or a = 21 or a = 22 then HorR1 = 1
If HorR1 = 0 Then If a = 27 or a = 28 or a = 29 then HorR1 = 1
If HorR1 = 0 Then If a = 34 or a = 35 or a = 36 then HorR1 = 1
If HorR1 = 0 Then If a = 41 or a = 42 or a = 43 then HorR1 = 1

If HorR1 = 0 Then If b = 7 or b = 8 or b = 9 then HorR1 = 1
If HorR1 = 0 Then If b = 14 or b = 15 or b = 16 then HorR1 = 1
If HorR1 = 0 Then If b = 21 or b = 22 or b = 23 then HorR1 = 1
If HorR1 = 0 Then If b = 28 or b = 29 or b = 30 then HorR1 = 1
If HorR1 = 0 Then If b = 35 or b = 36 or b = 37 then HorR1 = 1
If HorR1 = 0 Then If b = 42 or b = 43 or b = 44 then HorR1 = 1

If HorR1 = 0 Then If c = 8 or c = 9 or c = 10 then HorR1 = 1
If HorR1 = 0 Then If c = 15 or c = 16 or c = 17 then HorR1 = 1
If HorR1 = 0 Then If c = 22 or c = 23 or c = 24 then HorR1 = 1
If HorR1 = 0 Then If c = 29 or c = 30 or c = 31 then HorR1 = 1
If HorR1 = 0 Then If c = 36 or c = 37 or c = 38 then HorR1 = 1
If HorR1 = 0 Then If c = 43 or c = 44 or c = 45 then HorR1 = 1

If HorR1 = 0 Then If Hotspot(a).tag <> TagNeed then HorR1 = 1
If HorR1 = 0 Then If Hotspot(b).tag <> TagNeed then HorR1 = 1
If HorR1 = 0 Then If Hotspot(c).tag <> TagNeed then HorR1 = 1

' *** Checks If * H * *

a = i - 1
b = i + 1
c = i + 2

If i > 47 or i < 1 then HorR2 = 1

If HorR2 = 0 Then If a = 5 or a = 6 or a = 7 then HorR2 = 1
If HorR2 = 0 Then If a = 12 or a = 13 or a = 14 then HorR2 = 1
If HorR2 = 0 Then If a = 19 or a = 20 or a = 21 then HorR2 = 1
If HorR2 = 0 Then If a = 26 or a = 27 or a = 28 then HorR2 = 1
If HorR2 = 0 Then If a = 33 or a = 34 or a = 35 then HorR2 = 1
If HorR2 = 0 Then If a = 40 or a = 41 or a = 42 then HorR2 = 1

If HorR2 = 0 Then If i = 6 or i = 7 or i = 8 then HorR2 = 1
If HorR2 = 0 Then If i = 13 or i = 14 or i = 15 then HorR2 = 1
If HorR2 = 0 Then If i = 20 or i = 21 or i = 22 then HorR2 = 1
If HorR2 = 0 Then If i = 27 or i = 28 or i = 29 then HorR2 = 1
If HorR2 = 0 Then If i = 34 or i = 35 or i = 36 then HorR2 = 1
If HorR2 = 0 Then If i = 41 or i = 42 or i = 43 then HorR2 = 1

If HorR2 = 0 Then If b = 7 or b = 8 or b = 9 then HorR2 = 1
If HorR2 = 0 Then If b = 14 or b = 15 or b = 16 then HorR2 = 1
If HorR2 = 0 Then If b = 21 or b = 22 or b = 23 then HorR2 = 1
If HorR2 = 0 Then If b = 28 or b = 29 or b = 30 then HorR2 = 1
If HorR2 = 0 Then If b = 35 or b = 36 or b = 37 then HorR2 = 1
If HorR2 = 0 Then If b = 42 or b = 43 or b = 44 then HorR2 = 1

If HorR2 = 0 Then If c = 8 or c = 9 or c = 10 then HorR2 = 1
If HorR2 = 0 Then If c = 15 or c = 16 or c = 17 then HorR2 = 1
If HorR2 = 0 Then If c = 22 or c = 23 or c = 24 then HorR2 = 1
If HorR2 = 0 Then If c = 29 or c = 30 or c = 31 then HorR2 = 1
If HorR2 = 0 Then If c = 36 or c = 37 or c = 38 then HorR2 = 1
If HorR2 = 0 Then If c = 43 or c = 44 or c = 45 then HorR2 = 1

If HorR2 = 0 Then If Hotspot(a).tag <> TagNeed then HorR2 = 1
If HorR2 = 0 Then If Hotspot(b).tag <> TagNeed then HorR2 = 1
If HorR2 = 0 Then If Hotspot(c).tag <> TagNeed then HorR2 = 1

' *** Checks If * * H *

a = i - 2
b = i - 1
c = i + 1

If i > 48 or i < 2 then HorR3 = 1

If HorR3 = 0 Then If a = 5 or a = 6 or a = 7 then HorR3 = 1
If HorR3 = 0 Then If a = 12 or a = 13 or a = 14 then HorR3 = 1
If HorR3 = 0 Then If a = 19 or a = 20 or a = 21 then HorR3 = 1
If HorR3 = 0 Then If a = 26 or a = 27 or a = 28 then HorR3 = 1
If HorR3 = 0 Then If a = 33 or a = 34 or a = 35 then HorR3 = 1
If HorR3 = 0 Then If a = 40 or a = 41 or a = 42 then HorR3 = 1

If HorR3 = 0 Then If b = 6 or b = 7 or b = 8 then HorR3 = 1
If HorR3 = 0 Then If b = 13 or b = 14 or b = 15 then HorR3 = 1
If HorR3 = 0 Then If b = 20 or b = 21 or b = 22 then HorR3 = 1
If HorR3 = 0 Then If b = 27 or b = 28 or b = 29 then HorR3 = 1
If HorR3 = 0 Then If b = 34 or b = 35 or b = 36 then HorR3 = 1
If HorR3 = 0 Then If b = 41 or b = 42 or b = 43 then HorR3 = 1

If HorR3 = 0 Then If i = 7 or i = 8 or i = 9 then HorR3 = 1
If HorR3 = 0 Then If i = 14 or i = 15 or i = 16 then HorR3 = 1
If HorR3 = 0 Then If i = 21 or i = 22 or i = 23 then HorR3 = 1
If HorR3 = 0 Then If i = 28 or i = 29 or i = 30 then HorR3 = 1
If HorR3 = 0 Then If i = 35 or i = 36 or i = 37 then HorR3 = 1
If HorR3 = 0 Then If i = 42 or i = 43 or i = 44 then HorR3 = 1

If HorR3 = 0 Then If c = 8 or c = 9 or c = 10 then HorR3 = 1
If HorR3 = 0 Then If c = 15 or c = 16 or c = 17 then HorR3 = 1
If HorR3 = 0 Then If c = 22 or c = 23 or c = 24 then HorR3 = 1
If HorR3 = 0 Then If c = 29 or c = 30 or c = 31 then HorR3 = 1
If HorR3 = 0 Then If c = 36 or c = 37 or c = 38 then HorR3 = 1
If HorR3 = 0 Then If c = 43 or c = 44 or c = 45 then HorR3 = 1

If HorR3 = 0 Then If Hotspot(a).tag <> TagNeed then HorR3 = 1
If HorR3 = 0 Then If Hotspot(b).tag <> TagNeed then HorR3 = 1
If HorR3 = 0 Then If Hotspot(c).tag <> TagNeed then HorR3 = 1

' *** Checks If * * * H

a = i - 3
b = i - 2
c = i - 1

If i > 49 or i < 3 then HorR4 = 1

If HorR4 = 0 Then If a = 5 or a = 6 or a = 7 then HorR4 = 1
If HorR4 = 0 Then If a = 12 or a = 13 or a = 14 then HorR4 = 1
If HorR4 = 0 Then If a = 19 or a = 20 or a = 21 then HorR4 = 1
If HorR4 = 0 Then If a = 26 or a = 27 or a = 28 then HorR4 = 1
If HorR4 = 0 Then If a = 33 or a = 34 or a = 35 then HorR4 = 1
If HorR4 = 0 Then If a = 40 or a = 41 or a = 42 then HorR4 = 1

If HorR4 = 0 Then If b = 6 or b = 7 or b = 8 then HorR4 = 1
If HorR4 = 0 Then If b = 13 or b = 14 or b = 15 then HorR4 = 1
If HorR4 = 0 Then If b = 20 or b = 21 or b = 22 then HorR4 = 1
If HorR4 = 0 Then If b = 27 or b = 28 or b = 29 then HorR4 = 1
If HorR4 = 0 Then If b = 34 or b = 35 or b = 36 then HorR4 = 1
If HorR4 = 0 Then If b = 41 or b = 42 or b = 43 then HorR4 = 1

If HorR4 = 0 Then If c = 7 or c = 8 or c = 9 then HorR4 = 1
If HorR4 = 0 Then If c = 14 or c = 15 or c = 16 then HorR4 = 1
If HorR4 = 0 Then If c = 21 or c = 22 or c = 23 then HorR4 = 1
If HorR4 = 0 Then If c = 28 or c = 29 or c = 30 then HorR4 = 1
If HorR4 = 0 Then If c = 35 or c = 36 or c = 37 then HorR4 = 1
If HorR4 = 0 Then If c = 42 or c = 43 or c = 44 then HorR4 = 1

If HorR4 = 0 Then If i = 8 or i = 9 or i = 10 then HorR4 = 1
If HorR4 = 0 Then If i = 15 or i = 16 or i = 17 then HorR4 = 1
If HorR4 = 0 Then If i = 22 or i = 23 or i = 24 then HorR4 = 1
If HorR4 = 0 Then If i = 29 or i = 30 or i = 31 then HorR4 = 1
If HorR4 = 0 Then If i = 36 or i = 37 or i = 38 then HorR4 = 1
If HorR4 = 0 Then If i = 43 or i = 44 or i = 45 then HorR4 = 1

If HorR4 = 0 Then If Hotspot(a).tag <> TagNeed then HorR4 = 1
If HorR4 = 0 Then If Hotspot(b).tag <> TagNeed then HorR4 = 1
If HorR4 = 0 Then If Hotspot(c).tag <> TagNeed then HorR4 = 1

' Checks all vertical connections
' Checks H
'             *
'             *
'             *

a = i + 7
b = i + 14
c = i + 21

If i > 28 or i < 1 then VertR1 = 1

If VertR1 = 0 Then If Hotspot(a).tag <> TagNeed then VertR1 = 1
If VertR1 = 0 Then If Hotspot(b).tag <> TagNeed then VertR1 = 1
If VertR1 = 0 Then If Hotspot(c).tag <> TagNeed then VertR1 = 1

' Checks *
'             H
'             *
'             *

a = i - 7
b = i + 7
c = i + 14

If i > 35 or i < 8 then VertR2 = 1

If VertR2 = 0 Then If Hotspot(a).tag <> TagNeed then VertR2 = 1
If VertR2 = 0 Then If Hotspot(b).tag <> TagNeed then VertR2 = 1
If VertR2 = 0 Then If Hotspot(c).tag <> TagNeed then VertR2 = 1

' Checks *
'             *
'             H
'             *

a = i - 14
b = i - 7
c = i + 7

If i > 42 or i < 15 then VertR3 = 1

If VertR3 = 0 Then If Hotspot(a).tag <> TagNeed then VertR3 = 1
If VertR3 = 0 Then If Hotspot(b).tag <> TagNeed then VertR3= 1
If VertR3 = 0 Then If Hotspot(c).tag <> TagNeed then VertR3 = 1

' Checks *
'             *
'             *
'             H

a = i - 21
b = i - 14
c = i - 7

If i > 42 or i < 22 then VertR4 = 1

If VertR4 = 0 Then If Hotspot(a).tag <> TagNeed then VertR4 = 1
If VertR4 = 0 Then If Hotspot(b).tag <> TagNeed then VertR4= 1
If VertR4 = 0 Then If Hotspot(c).tag <> TagNeed then VertR4 = 1

If HorR1 = 0 then PointsGained = PointsGained + 1
If HorR2 = 0 then PointsGained = PointsGained + 1
If HorR3 = 0 then PointsGained = PointsGained + 1
If HorR4 = 0 then PointsGained = PointsGained + 1
If VertR1 = 0 then PointsGained = PointsGained + 1
If VertR2 = 0 then PointsGained = PointsGained + 1
If VertR3 = 0 then PointsGained = PointsGained + 1
If VertR4 = 0 then PointsGained = PointsGained + 1

CheckIf = IsGameOver
If CheckIf = 0 then NextTurnCheck
If CheckIf = 1 then EndGame

End Sub
Chromegloss - Vanishes and then re-appears at complete random. [Working on Advanced Section of VBScript guide]
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Wed Sep 16, 2009 1:00 pm

Wow! that's a lot of code... I just used math formulas... But I can't seem to find the right one for the reverse diagonal checking.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby reneuend » Wed Sep 16, 2009 1:19 pm

I'll dig up mine and see if it helps. It's just an alogrithm. It would need to be enhanced to work for your game rules. It might help.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby Lyberodoggy » Wed Sep 16, 2009 3:27 pm

I figured it out. Here it goes (reverse diagonal checking):

Code: Select all
seconddiagonal=(cell mod 5)
If seconddiagonal<4 then seconddiagonal=seconddiagonal + 5
for h=seconddiagonal to seconddiagonal+15 step 5
If celldata=ReadINI("Board.ini","status",h) Then
same=same+1
If same=4 then exit for
Else
same=1
celldata=ReadINI("Board.ini","status",h)
End If
Next
If same=4 and celldata<>"" Then CheckFour=celldata
same=0
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to New Games Announcements

Who is online

Users browsing this forum: No registered users and 0 guests