Coder Social home page Coder Social logo

issotm / numflip-golf Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 88 KB

Code golfing contest: flip a number's digits

Shell 11.42% C 14.22% Python 3.25% Perl 1.22% JavaScript 2.57% C# 6.05% Rust 5.21% C++ 14.41% Java 1.93% Awk 6.27% sed 33.43%
code-golf golfing

numflip-golf's Introduction

numflip-golf

Code golfing contest: flip a number's digits!

Rules

Goal

Write a function or method that takes an integer between -999,999,999 and 999,999,999 (inclusive), and returns the integer whose decimal digits are flipped. Try making the source code as small as possible!

Examples: flip(5678) == 8765, flip(-541) == -145, flip(-100) == -1.

Scoring

  • Each character part of the function counts for 1 point, including spaces and newlines
  • The lower the amount of points, the better
  • Import / preproc directives, any global variables, etc. required for the function to work are counted as well
  • If using an online compiler (such as tio.run), any "boilerplate" necessary for the program to run will not be counted (main function, etc.), unless it falls into the clause above
  • For readability, newlines and comments that do not matter to the functionality will not be counted
  • Execution time and memory footprint are not relevant; it just needs to terminate eventually

Languages

All languages are allowed, with one leaderboard per language. (If you do it in Java, you'll still stand a chance to be #1!). Esoteric languages are accepted, but less relevant to this kind of challenge.

Constraints

  • The function parameter and return types must be numeric, unless the language makes that impossible (such as bash)
  • Non-standard imports are not allowed, even if popular (so no boost, lodash, numpy...)
  • The program execution must be deterministic
  • Relying on language extensions will be allowed on a case-by-case basis
  • Lambdas are accepted, but only if stored in a named variable (so they can be called like a normal function)
  • The code must be self-sufficient, thus it may not rely on external files, the program's file name, or touch the file system

Provision

  • The rules may be changed at any time to patch loopholes
  • Rule-bending submissions are accepted, and will be scored separately (see the troll)
  • Anything litigious will be left to my own discretion :)

numflip-golf's People

Contributors

issotm avatar

Watchers

 avatar  avatar  avatar

Forkers

jl2210

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.