Skip to content

Commit

Permalink
more pub coordination time and place modules
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 699155625
Change-Id: I9a85b93619db42e62d97922562663d553eee143a
  • Loading branch information
vezhnick authored and copybara-github committed Nov 22, 2024
1 parent 10bfba4 commit ca43f54
Show file tree
Hide file tree
Showing 4 changed files with 723 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
MONTH = 10
DAY = 14

NUM_PUBS = 2
NUM_PUBS = 3

PUB_PREFERENCES = {
"The Springbok's Lair": [
Expand Down Expand Up @@ -213,6 +213,8 @@ def sample_parameters(seed: int | None = None):
venue_preferences=pub_preferences,
social_context=SOCIAL_CONTEXT,
random_seed=seed,
num_main_players=6,
num_supporting_players=0,
)

all_names = list(MALE_NAMES) + list(FEMALE_NAMES)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
# Copyright 2024 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""A set of pub names and reasons to like them."""

import random
from examples.modular.environment import pub_coordination

YEAR = 2023
MONTH = 10
DAY = 14

NUM_PUBS = 3

PUB_PREFERENCES = {
"Sandy Bell's": [
"Traditional pub with a lively atmosphere",
"Known for its folk music sessions",
"Wide selection of Scottish beers and whiskies",
"Friendly staff and a welcoming environment",
],
"The Salt Horse": [
"Cozy and intimate setting with a fireplace",
"Rotating selection of craft beers on tap",
"Delicious pub fare with locally sourced ingredients",
"Great for a quiet pint or a catch-up with friends",
],
"The Sheep Held Inn": [
"Historic pub with a charming atmosphere",
"Large beer garden with stunning views of the city",
"Gastropub menu with a focus on Scottish cuisine",
"Perfect for a special occasion or a romantic evening",
],
"The Canny Man's": [
"Quirky and eclectic pub with a unique atmosphere",
"Wide range of international beers and spirits",
"Hidden gem with a loyal local following",
"Great for a conversation and a relaxed drink",
],
"The Guildford Arms": [
"Traditional pub with a Victorian interior",
"Popular with students and locals alike",
"Affordable prices and a lively atmosphere",
"Perfect for a casual night out with friends",
],
"The Bow Bar": [
"Wide selection of whiskies and real ales",
"Knowledgeable staff who can recommend a dram",
"Traditional pub with a relaxed atmosphere",
"Great for a whisky tasting or a quiet pint",
],
"The Blue Moon": [
"Historic pub with a literary connection",
"Cozy and intimate setting with a fireplace",
"Wide selection of Scottish gins and cocktails",
"Perfect for a romantic date or a special occasion",
],
"The Ensign Ewart": [
"Traditional pub with a military history",
"Located near Edinburgh Castle",
"Popular with tourists and locals alike",
"Great for a pint and a bite to eat after sightseeing",
],
"The Hanging Bat": [
"Craft beer bar with a wide selection of international beers",
"Lively atmosphere with regular events and live music",
"Great for a night out with friends",
"Popular with beer enthusiasts",
],
}


SOCIAL_CONTEXT = [
(
"The Royal Mile is bustling with tourists and street performers."
" {players} navigate the crowds, admiring the historic buildings. The"
" sound of bagpipes fills the air. {player_name} just arrived, their"
" eyes wide with excitement."
),
(
"A cool mist hangs over the city as {players} climb Calton Hill. The "
"view from the top is breathtaking, with the cityscape stretching out "
"before them. They pause to catch their breath, admiring the panoramic "
"vista. {player_name} just arrived, their face flushed from the climb."
),
(
"The aroma of coffee fills the air in Stockbridge. {players} stroll "
"along the charming streets, browsing the independent shops and cafes. "
"They stop for a coffee and a pastry, enjoying the relaxed atmosphere. "
"{player_name} just arrived, their smile widening at the sight of the "
"quaint neighborhood."
),
(
"The sound of laughter echoes through the Grassmarket as {players}"
" explore the lively market stalls. They haggle for souvenirs and"
" sample local delicacies. The atmosphere is festive and vibrant."
" {player_name} just arrived, their senses bombarded with the sights,"
" sounds, and smells."
),
(
"The sun sets over the Firth of Forth, casting a golden glow on the"
" water. {players} walk along Portobello Beach, enjoying the fresh air"
" and the sound of the waves. They find a bench and watch the sun dip"
" below the horizon. {player_name} just arrived, their heart filled"
" with a sense of peace."
),
]

RUGBY_COUNTRIES = [
"South Africa",
"New Zealand",
"France",
"Ireland",
"England",
"Australia",
"Argentina",
"Wales",
"Scotland",
"Fiji",
"Japan",
"Italy",
"Samoa",
"Georgia",
"Tonga",
"Romania",
"Namibia",
"Uruguay",
"Chile",
"Portugal",
]

FEMALE_NAMES = [
"Ailsa MacDonald",
"Catriona Campbell",
"Fiona Stewart",
"Isla MacLeod",
"Morag MacKay",
"Shona Cameron",
"Iona Ross",
"Mhairi Wilson",
"Kirsty Robertson",
"Eilidh Davidson",
]

MALE_NAMES = [
"Angus Graham",
"Calum Scott",
"Douglas Reid",
"Euan Murray",
"Fraser Clark",
"Hamish Taylor",
"Iain Brown",
"Malcolm Mitchell",
"Niall Thomson",
"Rory Stewart",
]


def sample_parameters(seed: int | None = None):
"""Samples a set of parameters for the world configuration."""

seed = seed if seed is not None else random.getrandbits(63)
rng = random.Random(seed)

pubs = rng.sample(list(PUB_PREFERENCES.keys()), NUM_PUBS)
pub_preferences = {k: PUB_PREFERENCES[k] for k in pubs}

config = pub_coordination.WorldConfig(
year=YEAR,
location="Edinburgh",
event="The Rugby World Cup",
game_countries=RUGBY_COUNTRIES,
venues=pubs,
venue_preferences=pub_preferences,
social_context=SOCIAL_CONTEXT,
random_seed=seed,
pub_closed_probability=1.0,
num_games=5,
num_main_players=6,
num_supporting_players=0,
)

all_names = list(MALE_NAMES) + list(FEMALE_NAMES)

rng.shuffle(all_names)
config.people = all_names

for _, name in enumerate(MALE_NAMES):
config.person_data[name] = {"gender": "male"}
for _, name in enumerate(FEMALE_NAMES):
config.person_data[name] = {"gender": "female"}

return config
Loading

0 comments on commit ca43f54

Please sign in to comment.