From c9b5381c16fce563307379aa8b52a5b902a7cc98 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 9 Oct 2006 18:03:35 +0200 Subject: [PATCH] Add a list of names to pick from. Refactor a bit to allow different simulator stages. Create a bunch of random bots. --- sugar/simulator.py | 4 +++- tests/simulator/{bots => demo}/chaitanya.py | 0 tests/simulator/{bots => demo}/kiu.py | 0 tests/simulator/demo/others.py | 5 +++++ tests/simulator/{bots => demo}/penelope.py | 0 tests/simulator/simulator | 6 +++--- tools/nicks-to-list | 18 ++++++++++++++++++ 7 files changed, 29 insertions(+), 4 deletions(-) rename tests/simulator/{bots => demo}/chaitanya.py (100%) rename tests/simulator/{bots => demo}/kiu.py (100%) create mode 100644 tests/simulator/demo/others.py rename tests/simulator/{bots => demo}/penelope.py (100%) create mode 100755 tools/nicks-to-list diff --git a/sugar/simulator.py b/sugar/simulator.py index 1e48229c..b1cd5615 100644 --- a/sugar/simulator.py +++ b/sugar/simulator.py @@ -9,6 +9,8 @@ from sugar import util _PRESENCE_SERVICE_TYPE = "_presence_olpc._tcp" +_nick_names = ['Aba', 'Abebe', 'Abebi', 'Abena', 'Abeni', 'Abeo', 'Abiba', 'Ada', 'Adah', 'Adana', 'Adanna', 'Adanya', 'Aissa', 'Akili', 'Alika', 'Ama', 'Amadi', 'Ameena', 'Ameenah', 'Ami', 'Amina', 'Aminah', 'Arziki', 'Asha', 'Ashia', 'Aziza', 'Baako', 'Binah', 'Binta', 'Bisa', 'Bolanle', 'Bunme', 'Caimile', 'Cataval', 'Chika', 'Chipo', 'Dalia', 'Dalila', 'Dayo', 'Deka', 'Delu', 'Denisha', 'Dore', 'Ebere', 'Fadhila', 'Faizah', 'Falala', 'Fayola', 'Feechi', 'Femi', 'Fisseha', 'Fola', 'Gamada', 'Ghalyela', 'Habika', 'Hada', 'Hadiya', 'Haiba', 'Halima', 'Hanzila', 'Hasina', 'Hija', 'Ilori', 'Iman', 'Imena', 'Iniko', 'Isabis', 'Isoke', 'Jahia', 'Jamelia', 'Jamila', 'Jamilah', 'Jamilia', 'Jamilla', 'Jamille', 'Jemila', 'Jendayi', 'Jina', 'Kabira', 'Kadija', 'Kafi', 'Kainda', 'Kali', 'Kalifa', 'Kanene', 'Kapera', 'Karimah', 'Kasinda', 'Keisha', 'Kesia', 'Lakeesha', 'Lateefah', 'Latrice', 'Latricia', 'Leal', 'Lehana', 'Limber', 'Lulu', 'Maha', 'Maizah', 'Malika', 'Mandisa', 'Mardea', 'Marjani', 'Marka', 'Nabelung', 'Nailah', 'Naima', 'Naja', 'Nakeisha', 'Narkeasha', 'Neda', 'Neema', 'Nichelle', 'Oba', 'Okoth', 'Ontibile', 'Orma', 'Pemba', 'Rabia', 'Rafiya', 'Ramla', 'Rashida', 'Raziya', 'Reta', 'Ridhaa', 'Saada', 'Sabra', 'Safara', 'Saidah', 'Salihah', 'Shasa', 'Shasmecka', 'Sibongile', 'Sika', 'Simbra', 'Sitembile', 'Siyanda', 'Sukutai', 'Tabita', 'Taifa', 'Taja', 'Takiyah', 'Tamala', 'Tamasha', 'Tanesha', 'Tanginika', 'Tanishia', 'Tapanga', 'Tarisai', 'Tayla', 'Tendai', 'Thandiwe', 'Tiesha', 'TinekaJawana', 'Tiombe', 'Wafa', 'Wangari', 'Waseme', 'Xhosa', 'Zabia', 'Zahara', 'Zahra', 'Zalika', 'Zanta', 'Zarina', 'Zina', 'Aba', 'Abebe', 'Abebi', 'Abena', 'Abeni', 'Abeo', 'Abiba', 'Ada', 'Adah', 'Adana', 'Adanna', 'Adanya', 'Aissa', 'Akili', 'Alika', 'Ama', 'Amadi', 'Ameena', 'Ameenah', 'Ami', 'Amina', 'Aminah', 'Amineh', 'Arziki', 'Asha', 'Ashia', 'Aziza', 'Baako', 'Binah', 'Binta', 'Bisa', 'Bolanle', 'Bunme', 'Caimile', 'Cataval', 'Chika', 'Chipo', 'Dalila', 'Dayo', 'Deka', 'Delu', 'Denisha', 'Dore', 'Ebere', 'Fadhila', 'Faizah', 'Falala', 'Fayola', 'Feechi', 'Femi', 'Fisseha', 'Fola', 'Gamada', 'Ghalyela', 'Habika', 'Hada', 'Hadiya', 'Haiba', 'Halima', 'Hanzila', 'Hasina', 'Hija', 'Ilori', 'Iman', 'Imena', 'Iniko', 'Isabis', 'Isoke', 'Jahia', 'Jamelia', 'Jamila', 'Jamilah', 'Jamilia', 'Jamilla', 'Jamille', 'Jemila', 'Jendayi', 'Jina', 'Kabira', 'Kadija', 'Kafi', 'Kainda', 'Kali', 'Kalifa', 'Kanene', 'Kapera', 'Karimah', 'Kasinda', 'Keisha', 'Kesia', 'Lakeesha', 'Lateefah', 'Latrice', 'Leal', 'Lehana', 'Limber', 'Lulu', 'Maha', 'Maizah', 'Malika', 'Mandisa', 'Mandisa', 'Mardea', 'Marjani', 'Marka', 'Nabelung', 'Nailah', 'Naima', 'Naja', 'Nakeisha', 'Narkeasha', 'Neda', 'Neema', 'Nichelle', 'Oba', 'Okoth', 'Ontibile', 'Orma', 'Pemba', 'Rabia', 'Rafiya', 'Ramla', 'Rashida', 'Raziya', 'Reta', 'Ridhaa', 'Saada', 'Sabra', 'Safara', 'Saidah', 'Salihah', 'Shasa', 'Shasmecka', 'Sibongile', 'Sika', 'Simbra', 'Sitembile', 'Siyanda', 'Sukutai', 'Tabita', 'Taifa', 'Taja', 'Takiyah', 'Tale', 'Tale green', 'Tamala', 'Tamasha', 'Tanesha', 'Tanginika', 'Tanishia', 'Tapanga', 'Tarisai', 'Tayla', 'Tendai', 'Thandiwe', 'Tiesha', 'TinekaJawana', 'Tiombe', 'Wafa', 'Wangari', 'Waseme', 'Xhosa', 'Zabia', 'Zahara', 'Zahra', 'Zalika', 'Zanta'] + class _BotService(object): def __init__(self, bot): self._bot = bot @@ -68,7 +70,7 @@ class _WaitAction(object): class Bot(object): def __init__(self): - self.name = util.unique_id() + self.name = _nick_names[int(len(_nick_names) * random.random())] self.color = IconColor() self.icon = None diff --git a/tests/simulator/bots/chaitanya.py b/tests/simulator/demo/chaitanya.py similarity index 100% rename from tests/simulator/bots/chaitanya.py rename to tests/simulator/demo/chaitanya.py diff --git a/tests/simulator/bots/kiu.py b/tests/simulator/demo/kiu.py similarity index 100% rename from tests/simulator/bots/kiu.py rename to tests/simulator/demo/kiu.py diff --git a/tests/simulator/demo/others.py b/tests/simulator/demo/others.py new file mode 100644 index 00000000..3b1218f5 --- /dev/null +++ b/tests/simulator/demo/others.py @@ -0,0 +1,5 @@ +from sugar.simulator import Bot + +for i in range(0, 10): + bot = Bot() + bot.start() diff --git a/tests/simulator/bots/penelope.py b/tests/simulator/demo/penelope.py similarity index 100% rename from tests/simulator/bots/penelope.py rename to tests/simulator/demo/penelope.py diff --git a/tests/simulator/simulator b/tests/simulator/simulator index de216974..552512c6 100755 --- a/tests/simulator/simulator +++ b/tests/simulator/simulator @@ -13,10 +13,10 @@ PresenceService.start() base_path = os.path.abspath(os.path.dirname(__file__)) -bots_path = os.path.join(base_path, 'bots') -for bot_file in os.listdir(bots_path): +stage_path = os.path.join(base_path, 'demo') +for bot_file in os.listdir(stage_path): if bot_file.endswith('.py') and bot_file != 'kiu.py': - execfile(os.path.join(bots_path, bot_file)) + execfile(os.path.join(stage_path, bot_file)) mainloop = gobject.MainLoop() mainloop.run() diff --git a/tools/nicks-to-list b/tools/nicks-to-list new file mode 100755 index 00000000..d4116be7 --- /dev/null +++ b/tools/nicks-to-list @@ -0,0 +1,18 @@ +#!/usr/bin/python + +import sys + +result = '_nick_names = [\n' + +nicks_file = open(sys.argv[1], 'r') + +for line in nicks_file.readlines(): + name = line.strip() + result += '\'%s\', ' % (name) + +result += ']' + +nicks_file.close() + +print result +