Cistercian numerals: Difference between revisions
m
→{{header|Rust}}: remove unneeded decorations
m (→{{header|Rust}}: remove unneeded decorations) |
|||
Line 5,029:
/// initialize CANVAS
for i in 0..GRID_SIZE {
for j in 0..GRID_SIZE {
unsafe { CANVAS[i][j] = ' '; }
}
unsafe { CANVAS[i][5] = '#'; }
}
}
/// draw horizontal
for c in c1..=c2 {
unsafe { CANVAS[r][c] = '#'; }
}
}
/// draw vertical
for r in r1..=r2 {
unsafe { CANVAS[r][c] = '#'; }
}
}
/// draw diagonal NE to SW
for c in c1..=c2 {
unsafe { CANVAS[r + c - c1][c] = '#'; }
}
}
/// draw diagonal SE to NW
for c in c1..=c2 {
unsafe { CANVAS[r + c1 - c][c] = '#'; }
}
}
/// Mark the portions of the ones place.
match v {
1 => horizontal(6, 10, 0),
Line 5,083:
/// Mark the portions of the tens place.
match v {
1 => horizontal(0, 4, 0),
Line 5,099:
/// Mark the portions of the hundreds place.
match hundreds {
1 => horizontal(6, 10, 14),
Line 5,115:
/// Mark the portions of the thousands place.
match thousands {
1 => horizontal(0, 4, 14),
Line 5,131:
/// Mark the char matrix for the numeral drawing.
let thousands: i32 = v / 1000;
v %= 1000;
Line 5,152:
}
/// Test the drawings as
fn test_output(n: i32) {
println!("{n}");
unsafe {
▲ init_n();
▲ draw(n);
for line in CANVAS.iter() {
for c in line.iter() {
|