Crate binoxxo [] [src]

Binoxxo is a library to create and check binoxxo puzzles.

How to use

Add binoxxo to your dependencies.

Create a puzzle

A binoxxo puzzle is a square board with either X or O or empty fields. To fill the board the puzzler must fill the empty fields accourding to the binoxxo rules.

Board

You can create a board with the Board::FromStr.

use binoxxo::field::{Board, Field};
use std::str::FromStr;
let board = Board::from_str("
    X O X O
    O X O X
    X X O O
    O O X X"
).unwrap();

It creates a Board struct. You can also create Boards manually.

create_puzzle_board

Use create_puzzle_board to create a random puzzle:

let size = 10usize;
let guesses = 15usize;
let board = binoxxo::bruteforce::create_puzzle_board(size, guesses);

The size is length of one square side in number of fields. 10 is a common size.

guesses is an tuner for the difficulty of the resulting puzzle. The larger guesses the more complicated the resulting puzzle and the more empty fields does the board has.

create_full_board

You can also create a randomly full board without empty fields:

let size = 10usize;
let board = binoxxo::bruteforce::create_full_board(size);

See the create_board example for how to print the resulting board.

Check a board

You can check a full board with the is_valid_board:

use binoxxo::field::Board;
use binoxxo::rules::is_board_valid;
use std::str::FromStr;
let board = Board::from_str("
    X O X O
    O X O X
    X X O O
    O O X X"
).unwrap();
println!("Board is valid: {}", is_board_valid(&board));

Rules

  • there must be no empty fields
  • there must be no more than two fields of the same token
    • either X O O X or O X X O
    • but not X O O O or X X X O
  • each row and column must contain exactly the same numbers of X and O
  • each row and column must be unique

For more details see: https://www.kreuzwortraetsel.ch/techniken-binoxxo/ in German.

License

The crate is published under the MIT license.

Re-exports

pub use bruteforce::rules;

Modules

bruteforce

This module implements a brute force random puzzle creator for binoxxo. See submodules for details.

field

The field module just models a board and its fields. See: