Compare commits

..

2 Commits

Author SHA1 Message Date
6279e076ac Initialize rs schach engine 2021-11-10 20:53:13 +01:00
7edf459485 Revert "Start backend with rocket.rs"
This reverts commit 28011b8f93.
2021-11-09 21:41:29 +01:00
5 changed files with 3 additions and 1424 deletions

View File

1343
rs/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,8 @@
[package]
name = "schach"
version = "0.1.0"
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rocket = { version = "0.5.0-rc.1", features = ["json"] }
serde = "1.0.127"

View File

@@ -1,20 +1,3 @@
#[macro_use]
extern crate rocket;
use rocket::serde::{json::Json, Serialize};
#[derive(Serialize)]
struct Greeting<'a> {
hello: &'a str,
}
#[get("/")]
fn index() -> Json<Greeting<'static>> {
Json(Greeting {
hello: "Hello, world!",
})
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/api/", routes![index])
fn main() {
println!("Hello, world!");
}

View File

@@ -1,59 +0,0 @@
enum PieceKind {
Rook,
Knight,
Bishop,
King,
Queen,
Pawn,
}
enum PieceColor {
Black,
White,
}
enum Column {
A,
B,
C,
D,
E,
F,
G,
H,
}
enum Row {
_1,
_2,
_3,
_4,
_5,
_6,
_7,
_8,
}
type Position = (Column, Row);
struct Piece {
kind: PieceKind,
color: PieceColor,
position: Position,
}
struct Board {
pieces: Vec<Piece>,
}
impl Board {
fn fresh() -> Board {
Board {
pieces: vec![Piece {
kind: PieceKind::Rook,
color: PieceColor::Black,
position: (Column::A, Row::_8),
}],
}
}
}