<p>Hello Great Gophers!</p>
<p>I devised a solution for [Advent Of Code](adventofcode.com)'s 11th Day. It's a simple password generation while incrementing a text one by one like it would be a number. </p>
<p>I tried to do it with channels. The one without channels and []byte works perfectly. This one, not so much. :) </p>
<p>What my vision was is the following => </p>
<p>Have one buffered channel in which the password generator routine puts passwords into. The buffer shall be, like 100 passwords. Then have the checker routine which gets passwords FROM the generators buffered channel and checks them. It returns once it find a correct password. </p>
<p>I <em>THINK</em> I implemented this correctly, but if I understand it right, the checking is not in the same order as the passwords are put into the channel maybe? </p>
<p>Could somebody please take a look and say if my Channel implementation is correct? I'm guessing it isn't. :) Or that the two routines shouldn't be kicked of that way... Or anything is welcome, really.</p>
<p>Thank you ever so much!</p>
<p>Here is the Code => <a href="https://github.com/Skarlso/goprojects/blob/master/advent/solutions/password.go" rel="nofollow">Gihub Advent Of Code Day 11</a></p>
<p>Unfortunately the play.golang.org URL wasn't working because the process took too long. :( Sorry about that. But here it is never the less => <a href="https://play.golang.org/p/RcWeTmAB-7" rel="nofollow">Playground For Day 11</a>.</p>
<p><strong>EDIT</strong>:</p>
<p>I think I'm missing a <code>break</code> after this, no? </p>
<pre><code> if checked {
output <- s
//insert break here...
}
</code></pre>
<p>Thanks very much everyone!</p>
<hr/>**评论:**<br/><br/>skarlso: <pre><p>Why the downvote? An explanation would be nice.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传