Skip to content

Instantly share code, notes, and snippets.

@Kimundi
Last active December 22, 2015 20:19
Show Gist options
  • Save Kimundi/6526030 to your computer and use it in GitHub Desktop.
Save Kimundi/6526030 to your computer and use it in GitHub Desktop.
priv use std::prelude::*;
priv extern mod std;
mod __std_macros {
#[macro_escape];
#[doc(hidden)];
priv use std::prelude::*;
}
static SQUARE_SIZE: uint = 256;
static DEMI_SQUARE_SIZE: uint = SQUARE_SIZE / 2;
fn main() {
::std::io::print({
#[address_insignificant]
pub static __static_fmtstr: [::std::fmt::rt::Piece<'static>, ..2u] =
[
::std::fmt::rt::Argument(
::std::fmt::rt::Argument{
position: ::std::fmt::rt::ArgumentNext,
format: ::std::fmt::rt::FormatSpec{
fill: ' ',
align: ::std::fmt::parse::AlignUnknown,
flags: 0u,
precision: ::std::fmt::parse::CountImplied,
width: ::std::fmt::parse::CountImplied,
},
method: None,
}
),
::std::fmt::rt::String("\n")
];
let __arg0 = &None as uint;
unsafe {
::std::fmt::format(__static_fmtstr, [
::std::fmt::argument(::std::fmt::Default::fmt, __arg0)
])
}
});
}
struct Element {
x: uint,
y: uint,
attr1: uint,
attr2: uint,
}
impl Element {
fn new(&self, col: uint, line: uint, attr1: uint, attr2: uint) ->
Element {
Element{
x: col * SQUARE_SIZE + DEMI_SQUARE_SIZE,
y: line * SQUARE_SIZE + DEMI_SQUARE_SIZE,
attr1: attr1,
attr2: attr2,
}
}
}
enum Direction { None, North, East, South, West, }
enum Color { Red, Blue, Yellow, Green, Purple, Orange, }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment