Skip to content

Commit 31dcf4f

Browse files
committed
First commit
0 parents  commit 31dcf4f

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# What is Code Golf?
2+
3+
> Code golf is a type of recreational computer programming competition in which participants strive to achieve the shortest possible source code that solves a certain problem. Code golf challenges and tournaments may also be named with the programming language used. --- [Wikipedia](https://en.wikipedia.org/wiki/Code_golf)
4+
5+
# Rules
6+
7+
1. Submit code you wrote. Don't reuse someone else's code.
8+
2. **NO AI**
9+
3. Don't Google/Bing/DDG/Kagi for answers.
10+
4. All pull requests must be opened before Aug 14 2025 11:30 AM EDT.
11+
12+
13+
The shortest _correct_ program wins. In the event no submissions fully pass the test suite winners will be selected by number of passing test cases and code brevity.
14+
15+
## Supported Languages
16+
17+
* C#
18+
* Python
19+
* Go
20+
* Typescript/Javascript
21+
22+
# The Problem
23+
24+
Convert numbers written with Arabic numerals into Roman numerals.
25+
26+
| Arabic | Roman |
27+
| -----: | ----: |
28+
| 1 | I |
29+
| 2 | II |
30+
| 3 | III |
31+
| 4 | IV |
32+
| 5 | V |
33+
| 10 | X |
34+
| 20 | XX |
35+
| 25 | XXV |
36+
| 30 | XXX |
37+
| 40 | XL |
38+
| 50 | L |
39+
| 100 | C |
40+
| 200 | CC |
41+
| 400 | CD |
42+
| 500 | D |
43+
| 1000 | M |
44+
45+
## Example Conversions
46+
47+
`27` → `XXVII`
48+
49+
`238` → `CCXXXVIII`
50+
51+
`2019` → `MMXIX`
52+
53+
# Submission Requirements
54+
55+
All submissions should expect to be invoked from the command line with a single argument, the path to a text file. This file will contain 5 numbers written using Arabic numerals. Numbers are separated by a newline (`\n`). Submissions are expected to iterate over the numbers printing the Roman numeral translation for each to the console/stdout.
56+
57+
## Example
58+
59+
```python
60+
import sys
61+
62+
63+
def main():
64+
# Exit with error status if no filename provided
65+
if len(sys.argv) < 1:
66+
print("Filename missing!")
67+
sys.exit(1)
68+
69+
print(f"Input file: {sys.argv[0]}")
70+
# Open the file for reading
71+
with open(sys.argv[1], "r") as fd:
72+
line = fd.readline().strip()
73+
while line != "":
74+
# Convert line to Roman numeral
75+
print(line)
76+
line = fd.readline().strip()
77+
78+
79+
if __name__ == "__main__":
80+
main()
81+
```
82+
83+
This repo contains a [sample file](https://github.com/kevsmith/code_golf/blob/main/input.txt) you can use for development.
84+

input.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
43
2+
104
3+
243
4+
401
5+
3277

0 commit comments

Comments
 (0)