e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
98 lines
2.2 KiB
Plaintext
98 lines
2.2 KiB
Plaintext
fn blockMatches(index: usize, c: u8) -> Bool {
|
|
if index == 0 {
|
|
return c == 66 || c == 79
|
|
}
|
|
if index == 1 {
|
|
return c == 88 || c == 75
|
|
}
|
|
if index == 2 {
|
|
return c == 68 || c == 81
|
|
}
|
|
if index == 3 {
|
|
return c == 67 || c == 80
|
|
}
|
|
if index == 4 {
|
|
return c == 78 || c == 65
|
|
}
|
|
if index == 5 {
|
|
return c == 71 || c == 84
|
|
}
|
|
if index == 6 {
|
|
return c == 82 || c == 69
|
|
}
|
|
if index == 7 {
|
|
return c == 84 || c == 71
|
|
}
|
|
if index == 8 {
|
|
return c == 81 || c == 68
|
|
}
|
|
if index == 9 {
|
|
return c == 70 || c == 83
|
|
}
|
|
if index == 10 {
|
|
return c == 74 || c == 87
|
|
}
|
|
if index == 11 {
|
|
return c == 72 || c == 85
|
|
}
|
|
if index == 12 {
|
|
return c == 86 || c == 73
|
|
}
|
|
if index == 13 {
|
|
return c == 65 || c == 78
|
|
}
|
|
if index == 14 {
|
|
return c == 79 || c == 66
|
|
}
|
|
if index == 15 {
|
|
return c == 69 || c == 82
|
|
}
|
|
if index == 16 {
|
|
return c == 70 || c == 83
|
|
}
|
|
if index == 17 {
|
|
return c == 76 || c == 89
|
|
}
|
|
if index == 18 {
|
|
return c == 80 || c == 67
|
|
}
|
|
if index == 19 {
|
|
return c == 90 || c == 77
|
|
}
|
|
return false
|
|
}
|
|
|
|
fn chooseBlock(c: u8, used: Span<Bool>) -> i32 {
|
|
var index: usize = 0
|
|
while index < 20 {
|
|
if !used[index] && blockMatches(index, c) {
|
|
return index as i32
|
|
}
|
|
index = index + 1
|
|
}
|
|
return -1
|
|
}
|
|
|
|
fn canSpell(word: Span<u8>) -> Bool {
|
|
var used: [20]Bool = [false; 20]
|
|
var i: usize = 0
|
|
while i < std.mem.len(word) {
|
|
let block: i32 = chooseBlock(word[i], used)
|
|
if block < 0 {
|
|
return false
|
|
}
|
|
if used[block as usize] {
|
|
return false
|
|
}
|
|
used[block as usize] = true
|
|
i = i + 1
|
|
}
|
|
return true
|
|
}
|
|
|
|
pub fn main(world: World) -> Void raises {
|
|
if canSpell(std.mem.span("A")) && canSpell(std.mem.span("BARK")) && (!canSpell(std.mem.span("BOOK")) && canSpell(std.mem.span("TREAT"))) && (!canSpell(std.mem.span("COMMON")) && canSpell(std.mem.span("SQUAD")) && canSpell(std.mem.span("CONFUSE"))) {
|
|
check world.out.write("abc blocks ok\n")
|
|
}
|
|
}
|