蓝牙配对不弹配对框_配对编程电源激活

蓝牙配对不弹配对框

A concept central to coding effectively is pair programming. It takes the old maxim of “two minds are better than one” and makes it real, uniting two programmers with a singular problem to solve. When pair programming, one person is a navigator (the person thinking about the problem and instructing the other to try certain solutions) and the other is a driver (the one coding).

配对编程是有效编码的核心概念。 它采用了“两个头脑胜于一个头脑”的古​​老格言,并使之成为现实,将两个程序员联合在一起解决一个单一的问题。 在进行配对编程时,一个人是导航员(思考问题并指示另一个人尝试某些解决方案的人),另一个人是驾驶员(一个编码)。

During my time during the Flatiron School, pair programming was a huge boon to my development. Not only did I get the chance to work on my communication skills but also glimpsed into someone else’s thought process, which usually led me to understand new concepts or code.

在我在熨斗学校期间,结对编程对我的发展大有裨益。 我不仅有机会练习自己的沟通技巧,而且还瞥见了别人的思考过程,这通常使我了解新的概念或代码。

One of my biggest breakthrough moments at Flatiron School was my time spent pair programming with instructor Caryn McCarthy. Together, we arrived at a solution for a problem I’m pretty sure I would have never have solved by myself.

我在Flatiron学校最大的突破时刻之一就是我与导师Caryn McCarthy进行了配对编程。 在一起,我们达成了一个问题的解决方案,我很确定自己永远不会解决。

三合会的诡计 (The Trickiness of Triple Triad)

Image for post
Fanboy mode: on.
Fanboy模式:开。

“Games are really hard”, they said.

他们说:“游戏真的很难。”

“I don’t know, games are really complex,” they said.

他们说:“我不知道,游戏真的很复杂。”

So what did I do? I attempted to make a full card game in three weeks — that I’m still working on 3 months later!

那我该怎么办? 我试图在三周内制作出完整的纸牌游戏,但三个月后仍在努力!

When we were assigned our final project at Flatiron School, I let nostalgia inspire me and decided to create Triple Triad, a card-based mini-game created for the Playstation classic Final Fantasy 8.

当我们在Flatiron学校完成最后的项目时,我怀旧之情启发了我,并决定创建Triple Triad,这是一款为Playstation classic创建的基于纸牌的迷你游戏 最终幻想8

Image for post
Protagonist Squall has the values (clockwise from the topmost value) A, 4, 6, and 9.
主角Squall的值(从最高值开始顺时针方向)为A,4、6和9。

In this game, each player begins with a five-card hand inspired by the characters and creatures of that game’s world. Each of those cards has four values arranged in a diamond arrangement corresponding to each side of the card (top, left, right, bottom) and a background color signifying which player has possession of that card (A blue background for player 1 and red for player 2).

在该游戏中,每位玩家都从一张五张牌开始,该牌受到该游戏世界中人物和生物的启发。 这些卡中的每张卡都具有四个值,这些值以菱形排列,分别对应于卡的每一面(顶部,左侧,右侧,底部),以及表示哪个玩家拥有该卡的背景颜色(玩家1的背景为蓝色,而玩家1的背景为红色)播放器2)。

Here’s the rub: when a card (let’s call this card A) is played onto the board next to another card in the opponent’s possession (this’ll be card B), the two card’s adjacent values are compared.

这就是问题所在:当一张牌(叫这张牌A)在对手拥有的另一张牌(这就是牌B)旁边的棋盘上玩时,将比较两张牌的相邻值。

If card A’s value is higher than card B’s value, card B is captured and flips to the opposite color as a result (red to blue, or vice-versa) to signify possession. Play continues until the 3x3 grid is filled, at which point the player with the highest point total is declared the winner.

如果卡A的值高于卡B的值,则卡B被捕获并翻转为相反的颜色(红色变为蓝色,反之亦然)以表示拥有。 比赛一直持续到3x3网格被填满为止,这时总分最高的玩家将被宣布为获胜者。

Sounds straightforward enough, right? If you know about games, you’ll know to say no. However, as I didn’t, I charged forth with nothing but 15 weeks of code experience and blind courage.

听起来很简单,对吧? 如果您了解游戏,您会说不。 但是,正如我没有那样,除了15周的代码经验和盲目的勇气,我什么都没带。

Image for post
Photo by Sebastian Herrmann on Unsplash
塞巴斯蒂安·赫尔曼( Sebastian Herrmann)Unsplash拍摄的照片

So, that part about comparing card values? That was a major stumbling block for me at that point in my coding education. The good news is that I already created the 3x3 board with the following code in the Game component’s state:

那么,那部分关于比较卡的价值? 在那时,这是我编码培训中的主要绊脚石。 好消息是,我已经在Game组件的状态下用以下代码创建了3x3板:

Image for post

I quickly learned that boards in games can be tricky in and of themselves to program but decided to create an array of objects to represent the board and the cards in each space. As seen above, each object in the array has two keys, position and card, set to the position number on the 3x3 grid starting from the top left and going left to right and null value for card. With this set up, I’m able to change the value of the card to whatever card is played while maintaining the position number for later reference.

我很快了解到游戏中的棋盘本身很难编程,但决定创建一个对象数组来代表每个空间中的棋盘和纸牌。 如上所示,数组中的每个对象都有两个键:位置和卡片,设置为3x3网格上从左上角开始到左到右的位置编号,并且卡片的值为空。 通过此设置,我可以将卡的值更改为所玩的任何卡,同时保持位置编号以供以后参考。

Comparison, Comparison

比较,比较

Image for post
beasty . on 野兽。 在未 Unsplash 飞溅

Still, when confronted with the challenge of comparing card values, I was at a loss. I know a lot of other developers, seasoned or not, can relate: I felt like the more I thought about the problem, the more it unraveled and the more complex it became. Needing a hand, I tapped Caryn to help me navigate what were conceptually uncharted waters.

尽管如此,当面对比较卡值的挑战时,我还是茫然。 我知道很多其他经验丰富的开发人员(无论经验丰富与否)都可以联系:我觉得我对问题的思考越多,就越能阐明问题,变得越复杂。 我需要伸出援手,请Caryn帮助我浏览概念上未知的水域。

As the navigator, the way Caryn asked me the right questions helped me get closer to a starting point of a solution, something that two programmers at any level can help each other by doing.

作为导航员,Caryn向我提出正确的问题的方式使我更加接近解决方案的起点,这是任何级别的两位程序员都可以互相帮助的方式。

After a few questions and a light discussion, Caryn became the driver and coded an object we named a comparisonMap:

几个问题,光讨论后,卡林成了驱动器和编码,我们命名为comparisonMap的对象:

Image for post
I’ve neglected to paste the rest since it’s so long, but it continues on for each space on the board, 1 being the first space and 9 being the last.
我已经忽略了剩余的内容,因为它已经很长了,但是对于板上的每个空间,它都会继续存在,其中1是第一个空间,9是最后一个空间。

This comparison map is valuable not on its own but as a reference used by the function actually doing the comparison of card values. As you can see above, the comparison map is an object with a set of key/value pairs. The key is a number corresponding to a position on the board and the value is an array of objects with information necessary to make comparisons. Inside each object is the number of a position relevant as compared to the position selected by the current player and which values need to be compared from position.

该比较图不是很有价值,但可以作为实际进行卡值比较的功能使用的参考。 如上所示,比较图是一个具有一组键/值对的对象。 键是与板上位置相对应的数字,值是对象数组,其中包含进行比较所需的信息。 在每个对象内是与当前玩家选择的位置相比相关的位置编号,并且需要从位置比较哪些值。

When I finished writing out comparisonMap, it revealed a few things to me. The most important was how vital it is to have intermediaries helping a process along. I admit this is a very procedural way of working out this issue, but every step is another in the right direction. But more importantly, the reason why my mind was a blank void when confronted with this issue was because I psyched myself out imagining a crazy long and complicated solution. What I needed to do was start thinking a bit broader, a bit more conceptually, and a lot more programmatically.

当我写完了comparisonMap,它揭示了一些东西给我。 最重要的是,让中介机构协助整个过程至关重要。 我承认这是解决此问题的一种非常程序化的方式,但是每一步都是朝着正确方向迈出的一步。 但是更重要的是,当我面对这个问题时,我的头脑一片空白,这是因为我很想念自己,想出一个疯狂而漫长而复杂的解决方案。 我需要做的是开始思考更广泛,更概念化和更多编程的思想。

The comparisonMap solution and how it was used in the rest of my code represents some of the most interesting strides I made during my coding journey so far. I hope this experience helps you on yours too!

comparisonMap解决方案及其在我的其余代码中的使用方式代表了迄今为止我在编码过程中取得的一些最有趣的进步。 希望这种经验对您有所帮助!

While it’s still a work in progress, if you’d like to take a look at Triple Triad, you can do so here and here.

尽管这项工作仍在进行中,但如果您想了解Triple Triad,可以在这里这里进行

翻译自: https://medium.com/@nickechevarria/pair-programming-power-activate-47bcf9f9732b

蓝牙配对不弹配对框

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值