• Home
Name Date Size #Lines LOC

..--

AppScope/12-May-2024-3734

entry/12-May-2024-1,6581,431

screenshots/devices/12-May-2024-

.gitignoreD12-May-2024121 88

README.mdD12-May-20241.8 KiB3015

README_zh.mdD12-May-20241.9 KiB3316

build-profile.json5D12-May-20241 KiB4241

hvigorfile.jsD12-May-2024168 21

package.jsonD12-May-2024408 1919

README.md

1# Distributed Gobang
2
3### Introduction
4
5This sample shows Gobang, a popular game played with black and white stones on a go board, developed using the distributed data management function. The display effect is as follows:
6
7![](./screenshots/devices/index_en.png)
8
9### Concepts
10
11Distributed data management: implements distributed collaboration between databases of different devices. The apps save data to distributed databases and perform operations such as adding, deleting, modifying, querying, and synchronizing data between distributed databases by calling the distributed data APIs.
12
13### Required Permissions
14
15ohos.permission.DISTRIBUTED_DATASYNC
16
17### Usage
18
191. Start the app. After the permissions of the devices are checked, the devices on the same network are displayed. Touch the icon in the upper right corner and select the peer device to connect. If it is the first time to connect to the peer device, authentication is required. After the authentication is successful, the peer device is connected.
20
212. During the game, the user of the local device can restart the game or retract a false move. The user of the peer device cannot. Touching an empty intersection on the go board once presets the target place to move. You can touch it again to move your stone there or touch another empty intersection if you change your mind. If the peer device exits or goes offline unexpectedly, the local user can reconnect to the peer device. After the remote device is connected, the local user can touch any position on the go board. Data will be synchronized to the peer device for the game to continue.
22
23### Constraints
24
25- This sample can only be run on standard-system devices.
26
27- This sample is based on the stage model, which is supported from API version 9.
28
29-  This sample requires DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022) to compile and run.
30

README_zh.md

1# 分布式五子棋
2
3### 简介
4
5五子棋是一款比较流行的棋类游戏,此游戏使用分布式数据管理功能进行开发完成的。实现效果如下:
6
7![](./screenshots/devices/index.png)
8
9### 相关概念
10
11分布式数据管理:分布式数据管理为应用程序提供不同设备间数据库的分布式协同能力。通过调用分布式数据各个接口,应用程序可将数据保存到分布式数据库中,并可对分布式数据库中的数据进行增加、删除、修改、查询、同步等操作。
12
13### 相关权限
14
15允许不同设备间的数据交换:ohos.permission.DISTRIBUTED_DATASYNC
16
17### 使用说明
18
191.启动应用,两个设备都确认权限后,并在同一个网络下,点击右上角图标,选择需要拉起的远程设备,点击后拉起远程设备,第一次拉起设备时,若未进行认证,输入认证码进行认证,认证成功后拉起远程设备。
20
212.游戏过程中,本地设备的用户可以重开,悔棋,远程设备无此功能。下子时,在棋盘某位置点击第一次时预下子,若确定下在该位置,继续点击该位置,若不确定,点击其他位置即可。若远程设备因特殊原因退出或者掉线,本地设备可重新拉起远程设备,拉起后,本地设备点击棋盘任意位置,数据会同步到远程设备,继续进行未完成的游戏。
22
23### 约束与限制
24
251.本示例仅支持标准系统上运行。
26
272.本示例为Stage模型,从API version 9开始支持。
28
293.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
30
314.本示例需要使用@ohos.distributedHardware.deviceManager系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)32
33