Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Install linera-storage-service'
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: linera-storage-service@0.15.3

- name: 'Install linera-service'
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: linera-service@0.15.3

- run: |
ln -s /opt/hostedtoolcache/linera-storage-service/bin/linera-storage-server /opt/hostedtoolcache/linera-service/bin/

- name: Run clippy
run: cargo clippy --locked --all-targets --all-features

Expand All @@ -41,9 +54,6 @@ jobs:
- name: 'Generate puzzles'
run: cargo run --locked --bin gol -- create-puzzles

- name: 'Install Linera CLI'
run: cargo install --locked linera-storage-service@0.15.3 linera-service@0.15.3

- name: 'Run code in README including code-generation'
run: linera extract-script-from-markdown backend/README.md | bash -ex

Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,14 @@ Run the commands below using `bash -e -x <(linera extract-script-from-markdown R

```bash
# Production app
APP_ID="c5b78269c7dfe9d121eab606c8f3ecd240de64d25b533b6f1009ac51c03d78ab"
APP_ID="27145fa604adf9996647a9a2add1dafe8f80f1a547835edf62ee408cd8903dd3"

# Test user
MATHIEU_CLI="0x359C1a2203aE35adBFA85bC9C1EAB540bF8797a7"

# Scoring chain
CHAIN="e71636fde3a70cdbfdb7fd9bef6cb1ba632af8b0567b8f76df47b35489972dd3"

# Test users
MATHIEU_WEB="0x9f48844812B32aF52822363f4e14A4b849c9c95b"
MATHIEU_CLI="0xc271f3fe7ce54619f5eb427bb77948097e76fcbfe7b0f82d9d88697d88accd19"

# Getting a chain and tracking the scores
FAUCET_URL=https://faucet.testnet-conway.linera.net

Expand All @@ -80,7 +79,7 @@ linera service --port 8080 &
```gql,uri=http://localhost:8080/chains/$CHAIN/applications/$APP_ID
query {
reportedSolutions {
entry(key: "$MATHIEU_WEB") {
entry(key: "$MATHIEU_CLI") {
key
value {
entries(input: {}) {
Expand Down
45 changes: 35 additions & 10 deletions backend/src/bin/gol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ fn create_puzzles(output_dir: &PathBuf, draft: bool) -> Result<(), Box<dyn std::
let puzzles = get_all_puzzles(draft);

for (name, puzzle_and_solution_creator) in puzzles {
let (puzzle, solution) = puzzle_and_solution_creator();
let (mut puzzle, solution) = puzzle_and_solution_creator();

let puzzle_path = output_dir.join(format!("{}_puzzle.bcs", name));
let solution_path = output_dir.join(format!("{}_solution.bcs", name));
Expand All @@ -262,8 +262,9 @@ fn create_puzzles(output_dir: &PathBuf, draft: bool) -> Result<(), Box<dyn std::
println!("{puzzle:#}");
println!("Created solution: {}", solution_path.display());
println!("{solution:#}");
puzzle.enforce_initial_conditions = true;
let steps = puzzle.check_solution(&solution)?;
println!("Verified solution: {steps} steps");
println!("Verified solution (and hints): {steps} steps");
println!();
}

Expand Down Expand Up @@ -292,10 +293,12 @@ fn create_block_puzzle_and_solution() -> (Puzzle, Board) {
let puzzle = Puzzle {
title: "Block".to_string(),
summary: "Create a stable 2x2 block pattern in the center of the board".to_string(),
difficulty: Difficulty::Easy,
difficulty: Difficulty::Tutorial,
size: 8,
metadata: String::new(),
minimal_steps: 1,
maximal_steps: 1,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
// Final conditions: exactly match the target pattern
Expand Down Expand Up @@ -331,10 +334,12 @@ fn create_beehive_puzzle_and_solution() -> (Puzzle, Board) {
let puzzle = Puzzle {
title: "Beehive".to_string(),
summary: "Create a stable beehive pattern (6-cell hexagonal shape)".to_string(),
difficulty: Difficulty::Easy,
difficulty: Difficulty::Tutorial,
size: 9,
metadata: String::new(),
minimal_steps: 1,
maximal_steps: 1,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
// Final conditions: exactly match the target pattern
Expand Down Expand Up @@ -372,10 +377,12 @@ fn create_loaf_puzzle_and_solution() -> (Puzzle, Board) {
let puzzle = Puzzle {
title: "Loaf".to_string(),
summary: "Create a stable loaf pattern (7-cell bread loaf shape)".to_string(),
difficulty: Difficulty::Easy,
difficulty: Difficulty::Tutorial,
size: 10,
metadata: String::new(),
minimal_steps: 1,
maximal_steps: 1,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
// Final conditions: exactly match the target pattern
Expand Down Expand Up @@ -410,10 +417,12 @@ fn create_boat_puzzle_and_solution() -> (Puzzle, Board) {
let puzzle = Puzzle {
title: "Boat".to_string(),
summary: "Create a stable boat pattern (5-cell boat shape)".to_string(),
difficulty: Difficulty::Easy,
difficulty: Difficulty::Tutorial,
size: 8,
metadata: String::new(),
minimal_steps: 1,
maximal_steps: 1,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
// Final conditions: exactly match the target pattern
Expand Down Expand Up @@ -447,10 +456,12 @@ fn create_tub_puzzle_and_solution() -> (Puzzle, Board) {
let puzzle = Puzzle {
title: "Tub".to_string(),
summary: "Create a stable tub pattern (4-cell hollow square)".to_string(),
difficulty: Difficulty::Easy,
difficulty: Difficulty::Tutorial,
size: 7,
metadata: String::new(),
minimal_steps: 1,
maximal_steps: 1,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
// Final conditions: exactly match the target pattern
Expand Down Expand Up @@ -486,10 +497,12 @@ fn create_blinker_puzzle_and_solution() -> (Puzzle, Board) {
title: "Blinker".to_string(),
summary: "Create a blinker oscillator pattern (3-cell vertical line that oscillates)"
.to_string(),
difficulty: Difficulty::Easy,
difficulty: Difficulty::Tutorial,
size: 7,
metadata: String::new(),
minimal_steps: 1,
maximal_steps: 1,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
// Final conditions: exactly match the target pattern
Expand Down Expand Up @@ -532,8 +545,10 @@ fn create_beacon_puzzle_and_solution() -> (Puzzle, Board) {
.to_string(),
difficulty: Difficulty::Easy,
size: 8,
metadata: String::new(),
minimal_steps: 1,
maximal_steps: 1,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
// Final conditions: exactly match the target pattern
Expand Down Expand Up @@ -573,8 +588,10 @@ fn create_clock_puzzle_and_solution() -> (Puzzle, Board) {
summary: "Create a clock oscillator pattern (period-4 oscillator)".to_string(),
difficulty: Difficulty::Easy,
size: 8,
metadata: String::new(),
minimal_steps: 1,
maximal_steps: 1,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
// Final conditions: exactly match the target pattern
Expand Down Expand Up @@ -627,12 +644,14 @@ fn create_four_blinkers_puzzle_and_solution() -> (Puzzle, Board) {
let final_conditions = final_board.to_exactly_matching_conditions();

let puzzle = Puzzle {
title: "Four blinkers".to_string(),
title: "Four Blinkers".to_string(),
summary: "Create four blinkers from very few cells".to_string(),
difficulty: Difficulty::Easy,
size,
metadata: String::new(),
minimal_steps: 10,
maximal_steps: 10,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
final_conditions,
Expand Down Expand Up @@ -692,8 +711,10 @@ fn create_robot_face_puzzle_and_solution() -> (Puzzle, Board) {
summary: "Create a robot-like face from very few cells".to_string(),
difficulty: Difficulty::Easy,
size,
metadata: String::new(),
minimal_steps: 170,
maximal_steps: 200,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions,
final_conditions,
Expand Down Expand Up @@ -734,8 +755,10 @@ fn create_glider_collision_puzzle_and_solution() -> (Puzzle, Board) {
summary: "Make two gliders collide and cancel each other out".to_string(),
difficulty: Difficulty::Easy,
size: 12,
metadata: String::new(),
minimal_steps: 16,
maximal_steps: 16,
enforce_initial_conditions: true,
is_strict: true,
initial_conditions: vec![
// First glider should be in top-left area
Expand Down Expand Up @@ -780,9 +803,11 @@ fn create_glider_migration_puzzle_and_solution() -> (Puzzle, Board) {
summary: "Guide a glider from the top-left square to the bottom-right square".to_string(),
difficulty: Difficulty::Easy,
size: 16,
metadata: String::new(),
minimal_steps: 40,
maximal_steps: 40,
is_strict: true,
enforce_initial_conditions: false,
is_strict: false,
initial_conditions: vec![
// Hint.
Condition::TestPosition {
Expand Down
Loading