Clique abaixo para nos ajudar
Conectar-se

Esqueci minha senha

Estamos no Facebook
Buscar
 
 

Resultados por:
 


Rechercher Busca avançada

Quem está conectado
12 usuários online :: Nenhum usuário registrado, Nenhum Invisível e 12 Visitantes :: 1 Motor de busca

Nenhum

[ Ver toda a lista ]


O recorde de usuários online foi de 468 em 1/3/2012, 10:43
Espessura do cursor intermitente

7/3/2017, 09:08 por Jefferson Matakas

Bom dia a todos !!

Existe uma opcao no windows que pode ser acessada atraves da 'central da …

Comentários: 0

DESENVOLVIMENTO EM REDES

4/3/2017, 18:45 por AJC

Pessoal tem ou conhece livros ou material para programação em
redes usando banco de dados nativo …

Comentários: 0

USAR REPORT FORM

30/12/2016, 09:06 por AJC

Pessoal bom dia,
Estou com um grande problema, já pesquisei muita coisa sobre report form, mas o …

Comentários: 4

Como preencher campos vazios

9/2/2017, 11:55 por Linghston

Pessoal boa tarde,

É o seguinte, eu preciso preencher os campos de uma coluna da tabela DBF que …

Comentários: 2

Enviar msg para WhatsAPP via VFP

7/2/2017, 10:31 por Eliana

Olá Pessoal!

Alguém sabe se é possível enviar mensagem para o WhatsAPP via VFP?


Grata


Comentários: 0

Estatísticas
Temos 7037 usuários registrados
O último usuário registrado atende pelo nome de GETULIO

Os nossos membros postaram um total de 31 mensagens em 17 assuntos

Games em FoxPro

Ver o tópico anterior Ver o tópico seguinte Ir em baixo

Astúcia Games em FoxPro

Mensagem por _batmanvfp_ em 11/2/2011, 16:12

O Jogo da Velha

Código:
********************************************
* Program: Tic Tac Toe Game
* Author: Glen T. Villar
* Date Created: 02/15/09
* Place of Creation: Papua New Guniea
* Version: 1.0
********************************************
Local oForm As Form, ;
lnLeft As Integer
oForm = Createobject('TestForm')
oForm.AddObject('ShapeCover','ShpCover')
oForm.Show()
Read Events
Return

Define Class TestForm As Form
AutoCenter = .T.
Height = 484
Width = 482
Caption = 'Tic Tac Toe'
ClickCount = 0
One = 0
Two = 0
Three = 0
Four = 0
Five = 0
Six = 0
Seven = 0
Eight = 0
Nine = 0
lnLastSquare = 0
lSwitch = .F.
ShapeName = ''
ShapeTop = 0

Add Object Shape1 As ShpVertical With ;
Left = 56, Width = 382, Top = 143, Height = 110
Add Object CmdStartNew As CommandButton With ;
Caption = 'Start New Game', AutoSize = .T., ;
Left = 24, Top = 443
Add Object Check1 As Checkbox With ;
Left = 310, Top = 430, AutoSize = .T., ;
Caption = 'Play against the computer.', ;
Value = 0
Add Object Check2 As Checkbox With ;
Left = 310, Top = 447, AutoSize = .T., ;
Caption = 'Computer vs Computer.', ;
Value = 0
Add Object Check3 As Checkbox With ;
Left = 170, Top = 447, AutoSize = .T., ;
Caption = 'Computer Level 1', ;
Value = 0
Add Object Timer1 As Timer With Enabled = .T., Interval = 1000
Add Object Timer2 As Timer With Enabled = .F., Interval = 1

Procedure Init
lnLeft = 56
For lnLines = 1 To 3
lcShape = 'SHA'+Alltrim(Str(lnLines))
This.AddObject(m.lcShape,'ShpVertical')
With Evaluate('This.'+m.lcShape)
.Left = m.lnLeft
Endwith
lnLeft = lnLeft + 127
Endfor
Set Safety Off
Create Cursor CurTest (Field1 Int, Field2 Int)
Index On Field1 To Field1
Create Cursor CurTEst2 (Field1 Int, Field2 Int)
Index On Field1 To Fieldx
Endproc

Procedure AddPiece
Lparameters lnColumn, lnRow, lnSquareLoc
Thisform.lSwitch = !Thisform.lSwitch
lcShapeName = Sys(2015)
This.AddObject(m.lcShapeName,'Shape')
With Evaluate('This.'+m.lcShapeName)
.Visible = .T.
.Height = 80
.Width = 80
.BackColor = Iif(This.lSwitch = .F.,Rgb(142,211,232),Rgb(239,117,75))
.Left = lnColumn
.Curvature = Iif(This.lSwitch = .F.,99,0)
.BorderWidth = 3
Endwith
Thisform.ShapeName = m.lcShapeName
Thisform.ShapeTop = lnRow
Thisform.Timer2.Enabled = .T.
This.ClickCount = This.ClickCount + 1
This.lnLastSquare = lnSquareLoc
Endproc

Procedure AI
Lparameters lnType1
If lnType1 = 2
Local lnSquare As Integer
Wait 'At least trying to think of a possible answer...' Window At Mrow(),Mcol() Timeout .5
lnSquare = Ceiling(9*Rand())
If Thisform.ClickCount < 9
Do While Evaluate('Thisform.'+Thisform.Translate(m.lnSquare)) > 0
lnSquare = Ceiling(9*Rand())
Enddo
Endif
For lnVar = 1 To 9
If !Seek(lnVar,'CurTEst')
Thisform.lSwitch=!Thisform.lSwitch
Insert Into CurTest Values (lnVar,Iif(Thisform.lSwitch=.F.,2,1))
Endif
Endfor
For lnVar = 3 To 9 Step 3
Select Sum(Field2) As Total From CurTest Where Between(Field1,lnVar-2,lnVar) Into Cursor TmpTotal
If TmpTotal.Total = 3 Or TmpTotal.Total = 6
Select * Distinct From CurTest Where Between(Field1,lnVar-2,lnVar) Into Cursor Gathered
Select Max(Gathered.Field1) As MaxNo, Min(Gathered.Field1) As MinNo From Gathered Into Cursor Maxi
For lnVar = Maxi.MinNo To Maxi.MaxNo
If !Seek(lnVar,'CurTEst2')
lnSquare = lnVar
Endif
Endfor
Endif
Endfor
lnNewValue = Thisform.CheckDown(m.lnSquare,4,1,7,1)
lnNewValue = Thisform.CheckDown(m.lnSquare,2,5,8,2)
lnNewValue = Thisform.CheckDown(m.lnSquare,3,6,9,3)
Insert Into CurTEst2 Values (m.lnNewValue,Iif(Thisform.lSwitch=.F.,2,1))
This.Placepiece(m.lnNewValue)
Else
Wait '' Timeout .5
Local lnSquare As Integer
lnSquare = Ceiling(9*Rand())
If Thisform.ClickCount < 9
Do While Evaluate('Thisform.'+Thisform.Translate(m.lnSquare)) > 0
lnSquare = Ceiling(9*Rand())
Enddo
Endif
This.Placepiece(m.lnSquare)
Endif
Endproc

Procedure CheckDown
Lparameters lnValue, lnHigh, lnLow, lnHigh2, lnLow2
Go Top In Select('CurTest')
lnTotal = CurTest.Field2
For lnVar = lnLow To lnHigh Step 3
If Seek(lnVar,'CurTest')
lnTotal = m.lnTotal + CurTest.Field2
lnLast = lnVar
Endif
Endfor
lnSquare = 0
If m.lnTotal = 3 Or m.lnTotal = 6
For lnVar = lnHigh2 To lnLow2 Step -3
If !Seek(lnVar,'CurTEst2')
lnSquare = lnVar
Endif
Endfor
Return m.lnSquare
Else
Return lnValue
Endif
Endproc

Procedure AnnounceWinner
Lparameters lnParam
Wait '' Timeout 1
lcString = Icase(lnParam = 1,'Winner on horizontal line!',lnParam = 2,'Winner on vertical line!','Winner on diagonal line!')
Messagebox(m.lcString,'Congratulations!')
This.NewGame
Endproc

Procedure CheckWins
Thisform.CheckWinner(2)
Thisform.CheckWinner(5)
Thisform.CheckWinner(8)
Thisform.CheckWinner2(4)
Thisform.CheckWinner2(5)
Thisform.CheckWinner2(7-1)
Thisform.CheckWinner3
Endproc

Procedure CheckWinner
Lparameters lnCenter As Integer
lnAdd = 0
For lnVar = lnCenter-1 To lnCenter+1
If Evaluate('Thisform.'+Thisform.Translate(lnVar)) > 0
lnAdd = lnAdd + Evaluate('Thisform.'+Thisform.Translate(lnVar))
Endif
Endfor
lcFirst = 'This.'+This.Translate(lnCenter-1)
lcSecond = 'This.'+This.Translate(lnCenter)
lcThird = 'This.'+This.Translate(lnCenter+1)
If m.lnAdd = 6 Or Evaluate(m.lcFirst) = 1 And Evaluate(m.lcSecond) = 1 And Evaluate(m.lcThird) = 1
This.AnnounceWinner(1)
Endif
Endproc

Procedure CheckWinner2
Lparameters lnCenter As Integer
lnCumu = 0
For lnVar = lnCenter-3 To lnCenter+3 Step 3
If Evaluate('Thisform.'+Thisform.Translate(lnVar)) > 0
lnCumu = lnCumu + Evaluate('Thisform.'+Thisform.Translate(lnVar))
Endif
Endfor
lcStr1 = 'This.'+This.Translate(lnCenter-3)
lcStr2 = 'This.'+This.Translate(lnCenter)
lcStr3 = 'This.'+This.Translate(lnCenter+3)
If m.lnCumu = 6 Or Evaluate(m.lcStr1) = 1 And Evaluate(m.lcStr2) = 1 And Evaluate(m.lcStr3) = 1
This.AnnounceWinner(2)
Endif
Endproc

Procedure CheckWinner3
If (Thisform.One + Thisform.Five + Thisform.Nine) = 6 Or Thisform.One = 1 And Thisform.Five = 1 And Thisform.Nine = 1
This.AnnounceWinner(3)
Endif
If (Thisform.Three + Thisform.Five + Thisform.Seven) = 6 Or Thisform.Three = 1 And Thisform.Five = 1 And Thisform.Seven = 1
This.AnnounceWinner(3)
Endif
Endproc

Procedure NewGame
Zap In Select('CurTEst')
Zap In Select('CurTest2')
For lnSquares = 1 To 9
lcSquareNo = '_Screen.ActiveForm.'+Thisform.Translate(m.lnSquares)+'= 0'
Execscript(m.lcSquareNo)
Endfor
For Each loObject In Thisform.Objects FoxObject
If !Inlist(Upper(Left(loObject.Name,3)),'SHA','CMD','CHE')
If Upper(loObject.BaseClass) <> 'TIMER'
loObject.Visible = .F.
Endif
Endif
Endfor
Thisform.lSwitch = .F.
Thisform.ClickCount = 0
Endproc

Procedure Placepiece
Lparameters lnCase
If Vartype(lnCase) = 'N'
Do Case
Case lnCase = 1
Thisform.AddPiece(Iif(Thisform.One=0,80,1000),Iif(Thisform.One=0,45,1000),1)
Thisform.One = Iif(This.lSwitch = .F.,1,2)
Case lnCase = 2
Thisform.AddPiece(Iif(Thisform.Two=0,210,1000),Iif(Thisform.Two=0,45,1000),2)
Thisform.Two = Iif(This.lSwitch = .F.,1,2)
Case lnCase = 3
Thisform.AddPiece(Iif(Thisform.Three=0.,335,1000),Iif(Thisform.Three=0,45,1000),3)
Thisform.Three = Iif(This.lSwitch = .F.,1,2)
Case lnCase = 4
Thisform.AddPiece(Iif(Thisform.Four=0,80,1000),Iif(Thisform.Four=0,160,1000),4)
Thisform.Four = Iif(This.lSwitch = .F.,1,2)
Case lnCase = 5
Thisform.AddPiece(Iif(Thisform.Five=0,210,1000),Iif(Thisform.Five=0,160,1000),5)
Thisform.Five = Iif(This.lSwitch = .F.,1,2)
Case lnCase = 6
Thisform.AddPiece(Iif(Thisform.Six=0,335,1000),Iif(Thisform.Six=0,160,1000),6)
Thisform.Six = Iif(This.lSwitch = .F.,1,2)
Case lnCase = 7
Thisform.AddPiece(Iif(Thisform.Seven=0,80,1000),Iif(Thisform.Seven=0,270,1000),7)
Thisform.Seven = Iif(This.lSwitch = .F.,1,2)
Case lnCase = 8
Thisform.AddPiece(Iif(Thisform.Eight=0,210,1000),Iif(Thisform.Eight=0,270,1000),8)
Thisform.Eight = Iif(This.lSwitch = .F.,1,2)
Case lnCase = 9
Thisform.AddPiece(Iif(Thisform.Nine=0,335,1000),Iif(Thisform.Nine=0,270,1000),9)
Thisform.Nine = Iif(This.lSwitch = .F.,1,2)
Endcase
Endif
Endproc

Procedure Translate
Lparameters lnValue As Integer
Return Icase(lnValue = 1,'One',lnValue = 2,'Two',lnValue = 3,'Three', ;
lnValue = 4,'Four',lnValue = 5,'Five',lnValue = 6,'Six',lnValue = 7,'Seven', ;
lnValue = 8,'Eight',lnValue = 9,'Nine')
Endproc
Procedure CmdStartNew.Click
Thisform.NewGame
Endproc
Procedure Check1.InteractiveChange
This.Caption = Iif(This.Value = 1,'Play against the computer.','Human vs Human.')
Endproc
Procedure Check1.ProgrammaticChange
This.Caption = Iif(This.Value = 1,'Play against the computer.','Human vs Human.')
Endproc
Procedure Check2.InteractiveChange
Thisform.Check1.Value = Iif(This.Value = 1,0,1)
Thisform.Check3.Value = Iif(This.Value = 1,1,0)
Endproc
Procedure Check3.InteractiveChange
This.Caption = Iif(This.Value = 0,'Computer Level 1','Computer Level 2')
Endproc
Procedure Check3.ProgrammaticChange
This.Caption = Iif(This.Value = 0,'Computer Level 1','Computer Level 2')
Endproc
Procedure Timer1.Timer
If Thisform.Check2.Value = 1
If Thisform.ClickCount < 9
Thisform.AI(Iif(Thisform.Check3.Value = 1,2,1))
Thisform.CheckWins
Else
Thisform.NewGame
Endif
Endif
Endproc
Procedure Timer2.Timer
With Evaluate('Thisform.'+Thisform.ShapeName)
If .Top < Thisform.ShapeTop
.Top = .Top + 1
Else
Thisform.Timer2.Enabled = .F.
Endif
Endwith
Endproc
Enddefine

Define Class ShpVertical As Shape
Height = 337
Width = 128
Visible = .T.
Top = 36
BackStyle = 0
Enddefine

Define Class ShpCover As Shape
Width = 505
Height = 420
Left = -1
BackStyle = 0
Visible = .T.
MousePointer = 15

Procedure Click
Local lnClicked As Integer
Do Case
Case Between(Mrow(),3,9) And Between(Mcol(),12,36)
lnClicked = 1
Case Between(Mrow(),3,9) And Between(Mcol(),37,61)
lnClicked = 2
Case Between(Mrow(),3,9) And Between(Mcol(),62,86)
lnClicked = 3
Case Between(Mrow(),10,17) And Between(Mcol(),12,36)
lnClicked = 4
Case Between(Mrow(),10,17) And Between(Mcol(),37,61)
lnClicked = 5
Case Between(Mrow(),10,17) And Between(Mcol(),62,86)
lnClicked = 6
Case Between(Mrow(),18,24) And Between(Mcol(),12,36)
lnClicked = 7
Case Between(Mrow(),18,24) And Between(Mcol(),37,61)
lnClicked = 8
Case Between(Mrow(),18,24) And Between(Mcol(),62,86)
lnClicked = 9
Endcase
Thisform.Placepiece(m.lnClicked)
If Thisform.Check1.Value = 1
Zap In Select('CurTest')
Insert Into CurTest Select * Distinct From CurTEst2
If Vartype(m.lnClicked) = 'N'
If !Seek(m.lnClicked,'CurTEst')
Insert Into CurTest Values (m.lnClicked, Iif(Thisform.lSwitch=.F.,1,2))
Insert Into CurTEst2 Values (m.lnClicked, Iif(Thisform.lSwitch=.F.,1,2))
Endif
Thisform.AI(Iif(Thisform.Check3.Value = 1,2,1))
Endif
Endif
Thisform.CheckWins
Endproc

Procedure Destroy
Clear Events
Endproc
Enddefine

_batmanvfp_
Participa Bastante
Participa Bastante


Voltar ao Topo Ir em baixo

Astúcia Re: Games em FoxPro

Mensagem por _batmanvfp_ em 11/2/2011, 16:15

Jogo Matemática

Código:

*----------------
* Math Game
* Author: Glenn T. Vilar
*----------------
Local oForm
oForm = Createobject('TestForm')
oForm.Show()
Read Events
Return

Define Class TestForm As Form
AutoCenter = .T.
Height = 386
Width = 236
nReiterate = 0
Caption = 'Math Game'

Add Object Text1 As TxtBox With Left = 54, Top = 70
Add Object Text2 As TxtBox With Left = 54, Top = 106
Add Object Text3 As TxtBox With Left = 54, Top = 158, Enabled = .T.
Add Object Command1 As CommandButton With Caption = 'Enter Answer', ;
 Autosize = .T., Left = 129, Top = 162
Add Object Label6 As Label With Caption = 'Difficulty Level:', ;
 Autosize = .T., Left = 69, Top = 31
Add Object OptionGroup1 As Opg1
Add Object Label1 As Label With AutoSize = .T., Left = 12, ;
 Fontsize = 36, Top = 80
Add Object Label2 As Label With FontSize = 14, AutoSize = .T., ;
 Left = 29, Top = 211, FontUnderline = .T., Caption = 'Correct Answer:'
Add Object Label3 As Label With FontSize = 14, AutoSize = .T., ;
 Left = 29, Top = 239, ForeColor = Rgb(96,96,96), Caption = 'Your Answer:'
Add Object Label4 As Label With Caption = 'Correct:', ;
 Autosize = .T., Left = 33, Top = 287
Add Object Label5 As Label With Caption = 'Wrong:', ;
 Autosize = .T., Left = 37, Top = 319
Add Object Label7 As Label With Caption = '%', AutoSize = .T., ;
 Left = 58, Top = 347, FontSize = 14
Add Object Text4 As TxtBox With Left = 82, ;
 Top = 280, Enabled = .F.
Add Object Text5 As TxtBox With Left = 82, Top = 312
Add Object Text6 As TxtBox With Left = 82, Top = 344, InputMask = '###'

Procedure Init
 This.Setnumbers
 This.Text3.SetFocus
Endproc

Procedure Setnumbers
 This.Text1.Value = Ceiling(Iif(This.OptionGroup1.Value = 1,10,100)*Rand())
 This.Text2.Value = Ceiling(Iif(This.OptionGroup1.Value = 1,10,100)*Rand())
 This.Label1.Caption = Icase(Between(Ceiling(10*Rand()),1,4),'+', ;
  Between(Ceiling(10*Rand()) ,5,8),'-','x')
Endproc

Procedure Command1.Click
 Local lSign As String, lTop As Integer, lDown As Integer, lResult As Integer
 Thisform.nReiterate = Thisform.nReiterate + 1
 lnTop = Thisform.Text1.Value
 lnDown = Thisform.Text2.Value
 lcSign = Alltrim(Thisform.Label1.Caption)
 lnResult = Icase(m.lcSign = '+',m.lnTop+m.lnDown,;
  m.lcSign = '-',m.lnTop-m.lnDown,m.lnTop*m.lnDown)
 Thisform.Label2.Caption = 'Correct Answer: '+Transform(m.lnResult)
 Thisform.Label3.Caption = 'Your Answer: '+Transform(Thisform.Text3.Value)
 If m.lnResult = Thisform.Text3.Value
  Thisform.Text4.Value = Thisform.Text4.Value + 1
 Else
  Thisform.Text5.Value = Thisform.Text5.Value + 1
 Endif
 Thisform.Text6.Value = Round((Thisform.Text4.Value / Thisform.nReiterate) * 100,1)
 Thisform.Text3.Value = 0

 Thisform.Setnumbers
 Thisform.Text3.SetFocus
Endproc

Procedure Destroy
 Clear Events
Endproc
Enddefine

Define Class TxtBox As TextBox
Height = 31
Width = 62
DisabledBackColor = Rgb(255,255,255)
DisabledForeColor = Rgb(0,0,0)
FontSize = 14
Value = 0
SelectOnEntry = .T.
Enabled = .F.
Enddefine

Define Class Opg1 As OptionGroup
Left = 157
Top = 24
AutoSize = .T.

Add Object Option1 As OPt1 With Caption = 'Easy'
Add Object Option2 As OPt1 With Caption = 'Hard'
Enddefine

Define Class OPt1 As OptionButton
AutoSize = .T.
Enddefine

_batmanvfp_
Participa Bastante
Participa Bastante


Voltar ao Topo Ir em baixo

Astúcia Re: Games em FoxPro

Mensagem por FERNANDOMATRELLA em 11/2/2011, 16:58

bem legal porem o joguinho da matematica num sabe fazer calculos negativos vou tentar a arrumar e repostar pq -2 - -2 = -4 e nao 0 Smile

FERNANDOMATRELLA
Participa Bastante
Participa Bastante


Voltar ao Topo Ir em baixo

Astúcia Re: Games em FoxPro

Mensagem por _batmanvfp_ em 11/2/2011, 17:07

provavelmente no PRG deve faltar aquela regra

que ( - ) com ( - ) = +

_batmanvfp_
Participa Bastante
Participa Bastante


Voltar ao Topo Ir em baixo

Astúcia Re: Games em FoxPro

Mensagem por Tales Ruan em 11/2/2011, 17:22

[Você precisa estar registrado e conectado para ver este link.] escreveu:bem legal porem o joguinho da matematica num sabe fazer calculos negativos vou tentar a arrumar e repostar pq -2 - -2 = -4 e nao 0 Smile

Na verdade, está correto.. -2 MAIS -2 é -4, mas -2 MENOS -2 é 0.

Não precisa corrigir, por enquanto.
avatar
Tales Ruan
Participa Bastante
Participa Bastante


Voltar ao Topo Ir em baixo

Astúcia Re: Games em FoxPro

Mensagem por Marcos Guedes em 12/2/2011, 08:15

Muito bom!

_________________
Marcos Guedes - Programador e desenvolvedor Web.


Visite o nosso portal:
[Você precisa estar registrado e conectado para ver este link.]

Marcos Guedes
Webmaster
Webmaster


Voltar ao Topo Ir em baixo

Astúcia Re: Games em FoxPro

Mensagem por FERNANDOMATRELLA em 14/2/2011, 08:39

realmente faltei nessa aula de matematica

FERNANDOMATRELLA
Participa Bastante
Participa Bastante


Voltar ao Topo Ir em baixo

Astúcia Re: Games em FoxPro

Mensagem por marcio em 14/2/2011, 08:52

A regra é básica:

Na multiplicação, sinais iguais o resultado é positivo, e diferentes negativo:

Na adição/subtração, mantém o sinal do maior...

Very Happy

Abraços...
avatar
marcio
Participa Bastante
Participa Bastante


Voltar ao Topo Ir em baixo

Astúcia Re: Games em FoxPro

Mensagem por alceu11 em 19/2/2011, 08:00

mais um jogo
link
Clique aqui para baiixar o arquivo!
avatar
alceu11
Usuário 5 Estrelas
Usuário 5 Estrelas


Voltar ao Topo Ir em baixo

Ver o tópico anterior Ver o tópico seguinte Voltar ao Topo


 
Permissão deste fórum:
Você não pode responder aos tópicos neste fórum