|
Hi guys I have little bit Complex Algorithm to solve my little application using IF function.
I'm working on a little game using VB for that.
I have 12 buttons 3*4 three column and four rows. imagine these buttons as river and in the left or on the right side of the river there is a man would like to cross the river using these buttons as bridge.
the basic idea is if user presses the button there is message will show a question Yes or NO. if the answer is correct button turned to green otherwise will be blue if the answer incorrect.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x = MsgBox("moon is biger than Sun", MsgBoxStyle.YesNo)
If x = DialogResult.Yes Then
Button1.BackColor = Color.Blue
Else
Button1.BackColor = Color.Green
End If
End Sub
End
[Button 1] [Button 2] [Button 3]
[Button 4] [Button 5] [Button 6]
[Button 7] [Button 8] [Button 9]
[Button10] [Button11] [Button12]
case 1:
the player can go from 1 to 3 horizontal
also allowed to go diametrical or free direction like : 10 and then 7 and then 8 and then 9 OR
Case 2:
from 7 and then 9 and then back to 8 .
Case 3:
or 10 to 8 to 5 to 3
case 4:
9 to 5 to 7
a lot if cases players can goes with to win
Finally
a message will show up ( the player win if he answers correctly )
this is my Big problem I have to study all the case and using IF
not the correct method also I cant go with Switch method
then I found out I have to use math Algorithm ..
each button has value like button1 take 10 value if the answer correct and button2 takes 20 and button3 takes 30 value.
by this way I can use IF function or switch ...
because if the total comes to 60 the player will win
but still Complex Algorithm for me
what I should do if the player has free directions to win .
Player has random choosing
I got headache to just think how can I solve probabilities that user may use it to win.
I know that to make my life easy just I have to make rules but I try to challenge my self with open direction how can I solve this problem
|
|
|
|
|
..typically, there's a function that returns whether a particular move (based on startpos and desired endpos as arguments) is valid. Then you call that in loop.
|
|
|
|