-
Notifications
You must be signed in to change notification settings - Fork 2
/
hamlet1.rb
37 lines (31 loc) · 883 Bytes
/
hamlet1.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'ncurses'
begin
window = Ncurses.initscr
Ncurses.cbreak
# +insch+ inserts a single character
# +insertline+ inserts a blank line of text (must move cursor to the line you want to insert the line on)
# +delch+ deletes a character of text
# +deleteln+ deletes an entire line of text
Ham1 = "To be, or not to be: that is the question:\n"
Ham2 = "Whether 'tis nobler in the mind to suffer\n"
Ham3 = "The slings and arrows of outrageous fortune,\n"
Ham4 = "Or to take arms against a sea of troubles,\n"
Ham5 = "And by opposing end them?\n"
window.addstr Ham1
window.addstr Ham3
window.addstr Ham5
window.refresh
window.getch
window.move(1,0)
window.insertln
window.addstr Ham2
window.refresh
window.getch
window.move(3,0)
window.insertln
window.addstr Ham4
window.refresh
window.getch
ensure
Ncurses.endwin
end