Terminal control/Positional read: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 1:
{{task|Terminal control}}[[Terminal Control::task| ]]
Determine the character displayed on the screen at column 3, row 6 and store that character in a variable. Note that it is permissible to utilize system or language provided methods or system provided facilities, system maintained records or available buffers or system maintained display records to achieve this task, rather than query the terminal directly, if those methods are more usual for the system type or language.
 
=={{header|AutoHotkey}}==
Line 197:
The character at column 3, row 6 is 'A'
</pre>
 
=={{header|Perl 6}}==
{{trans|Python}}
<lang perl6>#!/usr/bin/env perl6
 
use v6;
use NCurses;
 
# Reference:
# https://github.com/azawawi/perl6-ncurses
 
# Initialize curses window
my $win = initscr() or die "Failed to initialize ncurses\n";
 
# Print random text in a 10x10 grid
 
for ^10 { mvaddstr($_ , 0, (for ^10 {(41 .. 90).roll.chr}).join )};
 
# Read
 
my $icol = 3 - 1;
my $irow = 6 - 1;
 
my $ch = mvinch($irow,$icol);
 
# Show result
 
mvaddstr($irow, $icol+10, 'Character at column 3, row 6 = ' ~ $ch.chr);
 
mvaddstr( LINES() - 2, 2, "Press any key to exit..." );
 
# Refresh (this is needed)
nc_refresh;
 
# Wait for a keypress
getch;
 
# Cleanup
LEAVE {
delwin($win) if $win;
endwin;
}</lang>
 
{{out}}
<pre>
+W18:5I<1N
N-I.HG45SK
BFJY8:AK)8
J+4U<H1++:
RP>BX-/19Y
URDESVX;HX Character at column 3, row 6 = D
J7+X3@E<BG
M;?2U<8+FI
)@BG,:D)O1
)>A-=LDY-.
 
 
 
 
 
 
 
 
 
 
 
 
Press any key to exit...
</pre>
 
 
=={{header|Phix}}==
Line 326 ⟶ 256:
<9HYH)<ZJF
</pre>
 
=={{header|Racket}}==
Works in a CMD box on Windows:
Line 340 ⟶ 271:
(printf "The character at 3x6 is <~a>\n" b))
</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
{{trans|Python}}
<lang perl6>#!/usr/bin/env perl6
 
use v6;
use NCurses;
 
# Reference:
# https://github.com/azawawi/perl6-ncurses
 
# Initialize curses window
my $win = initscr() or die "Failed to initialize ncurses\n";
 
# Print random text in a 10x10 grid
 
for ^10 { mvaddstr($_ , 0, (for ^10 {(41 .. 90).roll.chr}).join )};
 
# Read
 
my $icol = 3 - 1;
my $irow = 6 - 1;
 
my $ch = mvinch($irow,$icol);
 
# Show result
 
mvaddstr($irow, $icol+10, 'Character at column 3, row 6 = ' ~ $ch.chr);
 
mvaddstr( LINES() - 2, 2, "Press any key to exit..." );
 
# Refresh (this is needed)
nc_refresh;
 
# Wait for a keypress
getch;
 
# Cleanup
LEAVE {
delwin($win) if $win;
endwin;
}</lang>
 
{{out}}
<pre>
+W18:5I<1N
N-I.HG45SK
BFJY8:AK)8
J+4U<H1++:
RP>BX-/19Y
URDESVX;HX Character at column 3, row 6 = D
J7+X3@E<BG
M;?2U<8+FI
)@BG,:D)O1
)>A-=LDY-.
 
 
 
 
 
 
 
 
 
 
 
 
Press any key to exit...
</pre>
 
=={{header|REXX}}==
10,327

edits