Commit 0c214890 authored by Julien Lhermite's avatar Julien Lhermite
Browse files

Init mars lander

parent fa6ae32c
module.exports = {
root: true,
env: {
node: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
],
plugins: ["prettier", "@typescript-eslint"],
rules: {
quotes: ["error", "single", { avoidEscape: true }],
"comma-dangle": [
"error",
{
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
functions: "never",
},
],
"import/order": [
"error",
{
alphabetize: {
order: "asc",
caseInsensitive: true,
},
"newlines-between": "always",
},
],
"prettier/prettier": [
"error",
{
singleQuote: true,
trailingComma: "es5",
printWidth: 140,
},
],
},
settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
"import/core-modules": ["sinon"],
},
parserOptions: {
parser: "@typescript-eslint/parser",
},
overrides: [
{
files: ["**/__tests__/*.{j,t}s?(x)", "**/*.spec.{j,t}s?(x)"],
env: {
jest: true,
},
},
{
files: ["**/*.ts", "**/*.tsx"],
rules: {
"no-unused-vars": ["off"],
"no-undef": ["off"],
},
},
],
};
node_modules
dist
coverage
\ No newline at end of file
module.exports = {
roots: ["<rootDir>/src"],
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
moduleNameMapper: {
"@main(.*)$": "<rootDir>/src/main/$1",
"@test(.*)$": "<rootDir>/src/test/$1",
},
testEnvironment: "node",
};
This diff is collapsed.
{
"name": "mars-lander",
"version": "1.0.0",
"description": "Set up for resolving mars lander from Codingame",
"private": true,
"scripts": {
"build": "webpack",
"build:watch": "webpack --watch",
"test": "jest --watch",
"test:watch": "jest --watch",
"lint": "eslint ./src/**/*.ts",
"coverage": "jest --coverage"
},
"keywords": [],
"author": "Julien Lhermite",
"license": "MIT",
"devDependencies": {
"@types/jest": "^26.0.15",
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"eslint": "^7.14.0",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.4",
"jest": "26.6.3",
"ts-jest": "^26.4.4",
"ts-loader": "^8.0.11",
"typescript": "^4.1.2",
"webpack": "^5.9.0",
"webpack-cli": "^4.2.0"
},
"dependencies": {}
}
/**
* Save the Planet.
* Use less Fossil Fuel.
**/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const N: number = parseInt(readline()); // the number of points used to draw the surface of Mars.
for (let i = 0; i < N; i++) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const inputs: string[] = readline().split(" ");
const landX: number = parseInt(inputs[0]); // X coordinate of a surface point. (0 to 6999)
const landY: number = parseInt(inputs[1]); // Y coordinate of a surface point. By linking all the points together in a sequential fashion, you form the surface of Mars.
}
// game loop
// eslint-disable-next-line no-constant-condition
while (true) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const inputs: string[] = readline().split(" ");
const horizontalPosition: number = parseInt(inputs[0]);
const verticalPosition: number = parseInt(inputs[1]);
const horizontalSpeed: number = parseInt(inputs[2]); // in m/s, can be negative.
const verticalSpeed: number = parseInt(inputs[3]); // in m/s, can be negative.
const remainingFuel: number = parseInt(inputs[4]); // the quantity of remaining fuel in liters.
const spacecraftRotation: number = parseInt(inputs[5]); // the rotation angle in degrees (-90 to 90).
const thrustPower: number = parseInt(inputs[6]); // 0 to 4.
// Write an action using console.log()
// To debug: console.error('Debug messages...');
// R thrustPower. R is the desired rotation angle. thrustPower is the desired thrust power.
console.log("0 0");
}
describe("Jest configuration", () => {
it("should run typescript tests", () => {
expect(true).toBeTruthy();
});
});
{
"compilerOptions": {
"target": "ES2019",
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outDir": "./dist/",
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
const path = require("path");
module.exports = {
entry: "./src/main/index.ts",
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
alias: {
"@main": path.join(__dirname, "src", "main"),
"@test": path.join(__dirname, "src", "test"),
},
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
},
optimization: {
minimize: false,
},
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment