Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ICFP contest 2024
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nathaniel Mattsson
ICFP contest 2024
Commits
1c58af77
Commit
1c58af77
authored
8 months ago
by
Nathaniel Mattsson
Browse files
Options
Downloads
Patches
Plain Diff
Add encode and decode for ints
parent
8f127199
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
do.py
+21
-0
21 additions, 0 deletions
do.py
with
21 additions
and
0 deletions
do.py
+
21
−
0
View file @
1c58af77
...
...
@@ -8,6 +8,27 @@ def decode(msg):
def
encode
(
str
):
return
''
.
join
(
chr
(
alphabet
.
index
(
c
)
+
33
)
for
c
in
str
)
def
decodenum
(
str
):
num
=
0
i
=
1
for
c
in
str
:
num
=
num
+
(
ord
(
c
)
-
33
)
*
94
**
(
len
(
str
)
-
i
)
i
=
i
+
1
return
num
def
encodenum
(
num
):
str
=
''
i
=
0
while
(
num
//
(
94
**
i
)
>=
1
):
i
=
i
+
1
for
k
in
range
(
i
-
1
,
-
1
,
-
1
):
temp
=
num
//
(
94
**
k
)
num
=
num
-
temp
*
94
**
k
str
=
str
+
chr
(
temp
+
33
)
return
str
def
run
(
msg
):
response
=
requests
.
post
(
'
https://boundvariable.space/communicate
'
,
headers
=
{
'
Authorization
'
:
'
Bearer 8cd1314b-f873-4ab7-891f-781d814ed60e
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment