mirror of
https://github.com/swarm-game/swarm
synced 2024-11-22 01:21:07 +00:00
Watch for lodestone (#2146)
Some checks are pending
Haskell-CI-Windows / Haskell-CI - ${{ matrix.os }} - ghc-${{ matrix.ghc }} (3.10.1.0, 9.8.2, windows-latest) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.2.8, ghc, 9.2.8, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.4.8, ghc, 9.4.8, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.6.5, ghc, 9.6.5, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.8.2, ghc, 9.8.2, ghcup) (push) Waiting to run
JSON schema / Validate scenarios against schema (push) Waiting to run
YAML normalization / Ensure YAML files are normalized (push) Waiting to run
Some checks are pending
Haskell-CI-Windows / Haskell-CI - ${{ matrix.os }} - ghc-${{ matrix.ghc }} (3.10.1.0, 9.8.2, windows-latest) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.2.8, ghc, 9.2.8, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.4.8, ghc, 9.4.8, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.6.5, ghc, 9.6.5, ghcup) (push) Waiting to run
Haskell-CI / Haskell-CI - Linux - ${{ matrix.compiler }} (false, ghc-9.8.2, ghc, 9.8.2, ghcup) (push) Waiting to run
JSON schema / Validate scenarios against schema (push) Waiting to run
YAML normalization / Ensure YAML files are normalized (push) Waiting to run
* use `watch` to avoid busy-waiting for the bit seed to grow Prompted by #2140, which shows hundreds of `ishere` calls. | Before | After | |--------|--------| | <img width="143" alt="Screenshot 2024-09-15 at 10 02 51 PM" src="https://github.com/user-attachments/assets/174827e4-9371-4405-a6c2-dd20233e4588"> | <img width="143" alt="Screenshot 2024-09-15 at 10 01 32 PM" src="https://github.com/user-attachments/assets/a1d02d16-487c-46d0-b5f1-5aaf4da111cb"> | This should make the testing scenario take 0.1s from previous 0.5s. You can test it with: ```sh cabal run swarm-integration -O0 -- -p '/Testing\/562-lodestone/ ```
This commit is contained in:
parent
746be8f4f6
commit
c37334f4ae
@ -5,8 +5,10 @@ def ifC = \p.\t.\e.
|
||||
if b t e
|
||||
end;
|
||||
|
||||
def until = \p.\t.
|
||||
ifC p t {until p t}
|
||||
def waitFor = \e.\t.
|
||||
watch down;
|
||||
wait 100;
|
||||
ifC (ishere e) t {waitFor e t}
|
||||
end;
|
||||
|
||||
def repeat = \c.
|
||||
@ -29,18 +31,18 @@ end;
|
||||
|
||||
// get one lodestone
|
||||
build {log "Hey!"; turn north; m2; l <- grab; turn back; m2; place l};
|
||||
until (ishere "lodestone") {grab};
|
||||
waitFor "lodestone" {grab};
|
||||
|
||||
// get two bit (0)
|
||||
build {
|
||||
log "Hi!";
|
||||
repeat (
|
||||
log "I am going for a bit";
|
||||
turn east; m2; x <- until (ishere "bit (0)") {harvest}; turn back; m2; place x;
|
||||
turn east; m2; x <- waitFor "bit (0)" {harvest}; turn back; m2; place x;
|
||||
log "I brought a bit";
|
||||
)};
|
||||
until (ishere "bit (0)") {grab};
|
||||
until (ishere "bit (0)") {grab};
|
||||
waitFor "bit (0)" {grab};
|
||||
waitFor "bit (0)" {grab};
|
||||
|
||||
make "bit (1)";
|
||||
make "drill bit"
|
||||
|
@ -25,6 +25,7 @@ robots:
|
||||
- workbench
|
||||
- 3D printer
|
||||
- branch predictor
|
||||
- rolex
|
||||
inventory:
|
||||
- [10, drill]
|
||||
- [10, lambda]
|
||||
@ -37,6 +38,7 @@ robots:
|
||||
- [10, strange loop]
|
||||
- [10, branch predictor]
|
||||
- [10, toolkit]
|
||||
- [10, rolex]
|
||||
- [0, drill bit]
|
||||
- [0, bit (0)]
|
||||
- [0, bit (1)]
|
||||
|
Loading…
Reference in New Issue
Block a user