DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: webb123
今日帖子: 36
在线用户: 22
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/11/26 11:22:38
标题:
my game: Tic-Tac-Toe (Jogo da Velha) - 井字游戏 浏览:1298
加入我的收藏
楼主: Who can try it?

my game: Tic-Tac-Toe (Jogo da Velha) - 井字游戏

prj_Threads_jogo_da_velha.exe (2.23 MB)
https://workupload.com/file/XcabpvKDJck
此帖子包含附件:
PNG 图像
大小:58.1K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 yxsoft (yxsoft) ★☆☆☆☆ -
盒子活跃会员
2021/11/26 11:40:58
1楼: i tried. it works, and would you add a computer player?
----------------------------------------------
Great!
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/11/26 12:14:39
2楼: @yxsoft
firstly, thanks for your time

I dont have any idea to implement it... using AI for example...
im not good in this area..

but, Im thinking do a "remote" module for example = play remotly

what about it?
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/11/26 12:17:26
3楼: the main procedure is:

procedure TViewFormMain.MyShapeMouseDownEvent(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: integer);
  function ChangeColor(ACondition: Boolean; AColorTrue, AColorFalse: TColor): TColor;
  begin
    result := AColorFalse;
    //
    if ACondition then
      result := AColorTrue;
  end;

var
  AShape: TShape;
begin
  if not(Sender is TShape) then
    exit;
  //
  AShape := TShape(Sender);
  //
  if (AShape.Brush.Color = clWhite) then
  begin
    inc(LastClickToGameOver);
    //
    if (LastClickToGameOver = 1) then
    begin
      ClrBxPlayerOne.Enabled := false;
      ClrBxPlayerTwo.Enabled := false;
    end;
    //
    LastShapePlayed := AShape;
    //
    AShape.Brush.Color := ChangeColor(AShape.Tag = 0, ClrBxPlayerOne.Selected, ClrBxPlayerTwo.Selected);
    //
    AShape.Tag := 1 xor AShape.Tag;
    //
    DoesAnybodyWon(AShape);
    //
    ChangingSettingOtherShapes(AShape.Tag);
  end
  else
  begin
    if not(LastShapePlayed = nil) and (AShape = LastShapePlayed) and (AShape.Brush.Color = LastShapePlayed.Brush.Color) then
    begin
      dec(LastClickToGameOver);
      //
      AShape.Tag         := 1 xor AShape.Tag;
      AShape.Brush.Color := clWhite;
      //
      LastShapePlayed := nil;
      //
      ChangingSettingOtherShapes(AShape.Tag);
    end;
  end;
end;
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 stacker (OOP才是王道) ★☆☆☆☆ -
普通会员
2021/11/28 12:19:36
4楼: Use Minimax algorithm to implement AI will be great.
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/11/29 0:34:36
5楼: @stacker
please can you direct me? maybe I can do it... in my MAX ignorance >:_)))

hug
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 stacker (OOP才是王道) ★☆☆☆☆ -
普通会员
2021/11/30 11:37:11
6楼: http://delphiforfun.org/programs/nim_minimax.htm
----------------------------------------------
-
作者:
男 stacker (OOP才是王道) ★☆☆☆☆ -
普通会员
2021/11/30 11:39:24
7楼: Minimax can use in all AI game development, actually it just a variant of recursive function.
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行113.2813毫秒 RSS