Write a function in a programming language of your choice that does a diagonal sweep of 0's and a diagonal sweep of 1's or this crow stabs you!
e.g.
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 1 0 0 0
1 0 0 0 0
0 0 0 0 0
1 1 1 0 0
1 1 0 0 0
1 0 0 0 0
Attached: crowknife.jpg (529x416, 56K)
fn main() {
poo_init(5, 3);
}
fn poo_init(x: i32, y: i32) {
for i in 0..(x + y) {
for j in 0..y {
for k in 0..x {
print!("{}", if j + k < i { "1 " } else { "0 " })
}
println!();
}
println!();
}
}
Sorry this is wrong user, but I appreciate you trying it with Rust
I have no fucking clue what you expect me to do. Your explanation is severly lacking. Please elaborate.
If you want *exactly* what you posted replace x + y with y + 1, and print "e.g." first. Otherwise I don't know what the fuck you want.
shit thread apologist detected
I was only pretending to be retarded desu
now that I read again and think about it, yeah, I've no idea what the OP wants
**ELABORATION**
Your array can be any size, I don't care. Just make it a 2D array.
Iterate over it, do a diagonal sweep of 0's then a sweep of 1's which in a better example would look like:
0 0 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 1 0 0 1 1 0 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 1
Sorry, I realise my first example maybe threw you off and my explanation was rather lacking