3 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
4 // file at the top-level directory of this distribution and at
5 // http://rust-lang.org/COPYRIGHT.
7 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10 // option. This file may not be copied, modified, or distributed
11 // except according to those terms.
13 #[feature(managed_boxes)];
15 /// Map representation
31 impl fmt::Show for square {
32 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33 write!(f.buf, "{}", match *self {
38 closed_lift => { ~"L" }
46 fn square_from_char(c: char) -> square {
52 'L' => { closed_lift }
57 println!("invalid square: {:?}", c);
63 fn read_board_grid<rdr:'static + io::Reader>(mut input: rdr) -> vec!(vec!(square)) {
64 let mut input: &mut io::Reader = &mut input;
65 let mut grid = Vec::new();
66 let mut line = [0, ..10];
68 let mut row = Vec::new();
69 for c in line.iter() {
70 row.push(square_from_char(*c as char))
73 let width = grid[0].len();
74 for row in grid.iter() { assert!(row.len() == width) }
80 pub fn trivial_to_str() {
81 assert!(lambda.to_str() == "\\")