Allow bot names 1-9 instead of 1-3
This commit is contained in:
1 parent
fb28fefc8a
commit
1dd02f887c
9 files changed
+75
-48
No files matched your search
+6
-4
@@ -1,6 +1,5 @@
|
||||
import importlib
|
||||
import collections
|
||||
import re
|
||||
from math import floor, ceil, sqrt
|
||||
|
||||
from mosfet.info import blocks
|
||||
@@ -26,12 +25,15 @@ def phyp(p1, p2):
|
||||
|
||||
|
||||
def bot_name_family(name):
|
||||
"""Return a bot username with all digits removed, case-insensitively."""
|
||||
return re.sub(r'\d', '', str(name)).casefold()
|
||||
"""Return the group name for a bot ending in one digit from 1 to 9."""
|
||||
name = str(name or '').casefold()
|
||||
if len(name) > 1 and name[-1] in '123456789':
|
||||
return name[:-1]
|
||||
return name
|
||||
|
||||
|
||||
def find_nearby_bots(global_state, position, distance):
|
||||
"""Find nearby online bots sharing this bot's digits-stripped name."""
|
||||
"""Find nearby online bots sharing this bot's numbered name family."""
|
||||
own_name = str(global_state.get('name', '') or '')
|
||||
family = bot_name_family(own_name)
|
||||
if not family:
|
||||
|
||||
Reference in new issue
Block a user