Ruby 和控制台输出
通常,可以通过 Ruby 库在公共 Windows 控制台屏幕上的特定位置输出符号,该位置似乎是 80x25 ?
问题是需要绘制一个特定的“树”结构,如下所示:
│
├──x──y──z
│ │
│ ├──a──b──c
│ │
│ └──e──f──g
│
└──u──v──o
It is possible, generally, by means of Ruby library to output a symbol at specific location on a common Windows console screen, which seems to be 80x25 ?
The problem came up with the need to draw a specific 'tree' structure like this, for example:
│
├──x──y──z
│ │
│ ├──a──b──c
│ │
│ └──e──f──g
│
└──u──v──o
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您只是对在控制台中生成树感兴趣,这篇文章向您展示了如何使用 hirb 来做到这一点。
If you're just interested generating trees in the console, this post shows you how to do it with hirb.
您可以使用 Curses 的包装器,例如 one。
You could use a wrapper for Curses, like this one.
Win32Console 项目应该可以满足您的需求,甚至更多。另外,你的问题让我有点想起Ruby Quiz #14 (LCD Numbers)。
The Win32Console project should do what you want, and much more. Also, your question reminds me slightly of Ruby Quiz #14 (LCD Numbers).