├── .gitignore ├── LICENSE ├── README.md ├── beijing-life-gpt ├── README.md ├── beijing_life.py ├── prompt.md └── test.py └── forever-with-you ├── README.md ├── characters.zip ├── forever_with_you.py ├── prompt.md └── test.py /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Jim Liu 宝玉 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GPT Games 2 | 3 | - [北京浮生记 GPT](https://chat.openai.com/g/g-xEgLcBInA-bei-jing-fu-sheng-ji) 4 | 游戏北京浮生记的 GPT 版本,让你通过 ChatGPT 也可以体验游戏。 5 | image 6 | - [Tokimeki Memorial 〜forever with you〜❤️](https://chat.openai.com/g/g-Xn8A0QheE-tokimeki-memorial-forever-with-you) 7 | Tokimeki Memorial/ときめきメモリアル/心跳回忆/純愛手札 8 | ![image](https://github.com/JimLiu/gpt-games/assets/648674/47354445-bd8d-47e8-a0c9-217ea36fd429) 9 | 10 | ## System Design 系统设计 11 | 12 | ### High Level Design 13 | 14 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/eb15f43d-98c3-47c0-9a97-0b53fee79170) 15 | 16 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/c456154f-e1b6-495a-b4a4-13a30d48fde9) 17 | 18 | ### Work Flow 19 | 20 | #### Start Game 21 | 22 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/efe6d5ce-3937-4017-bf63-526942e25207) 23 | 24 | #### Each Round 25 | 26 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/59d7c2f6-d9a5-4309-94e4-533d4c77fcdf) 27 | -------------------------------------------------------------------------------- /beijing-life-gpt/README.md: -------------------------------------------------------------------------------- 1 | # 北京浮生记 GPT 2 | 3 | 北京浮生记 GPT 是游戏北京浮生记的 GPT 版本,让你通过 ChatGPT 也可以体验游戏。 4 | 5 | GPT 地址:https://chat.openai.com/g/g-xEgLcBInA-bei-jing-fu-sheng-ji 6 | 7 | image 8 | 9 | ![CleanShot 2024-02-02 at 00 45 32@2x](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/6f46b49d-d5b0-4c13-a680-e705cde7b16a) 10 | 11 | 12 | ## System Design 系统设计 13 | 14 | ### High Level Design 15 | 16 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/eb15f43d-98c3-47c0-9a97-0b53fee79170) 17 | 18 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/c456154f-e1b6-495a-b4a4-13a30d48fde9) 19 | 20 | ### Work Flow 21 | 22 | #### Start Game 23 | 24 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/efe6d5ce-3937-4017-bf63-526942e25207) 25 | 26 | 27 | #### Each Round 28 | 29 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/59d7c2f6-d9a5-4309-94e4-533d4c77fcdf) 30 | 31 | ## GPT Config 32 | 33 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/19ab66f0-d6f2-4acb-92f6-4408576716fb) 34 | 35 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/30c26e07-a706-40a0-a9a0-69f7d7320b0b) 36 | 37 | 38 | ## Screenshots 39 | 40 | 41 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/bb751636-a8d0-45d9-9bd6-43579eaf1799) 42 | 43 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/e4ff2de1-b43e-4619-9a16-5f7890a4543d) 44 | 45 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/b2b6aed0-29de-46ae-8b1f-923ee914f9a2) 46 | 47 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/9f2f9397-6e88-422c-baf2-603b618ba267) 48 | 49 | ![image](https://github.com/JimLiu/beijing-fushengji-gpt/assets/648674/5dfc9eaa-b97b-4886-bf6d-4c523ccad4ab) 50 | -------------------------------------------------------------------------------- /beijing-life-gpt/beijing_life.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | # Goods Configuration 4 | Goods = { 5 | "COSMETIC": "伪劣化妆品", 6 | "CIGARETTE": "进口香烟", 7 | "CAR": "进口汽车", 8 | "PHONES": "水货手机", 9 | "ALCOHOL": "假白酒", 10 | "BABY": "上海小宝贝 18 禁", 11 | "CD": "盗版 VCD, 游戏", 12 | "TOY": "进口玩具", 13 | } 14 | 15 | # Debt Rate 16 | debt_rate = 0.1 17 | 18 | # Max Capacity 19 | max_capacity = 100 20 | 21 | # Prices Configuration 22 | prices_config = { 23 | "CIGARETTE": {"min": 10, "base": 100, "max": 450}, 24 | "BABY": {"min": 1000, "base": 5000, "max": 14000}, 25 | "CD": {"min": 5, "base": 10, "max": 100}, 26 | "ALCOHOL": {"min": 100, "base": 1000, "max": 3500}, 27 | "COSMETIC": {"min": 10, "base": 65, "max": 300}, 28 | "CAR": {"min": 5000, "base": 15000, "max": 30000}, 29 | "PHONES": {"min": 500, "base": 750, "max": 1500}, 30 | "TOY": {"min": 100, "base": 250, "max": 850}, 31 | } 32 | 33 | # Market Prices (Initial Values) 34 | market_prices = { 35 | "CIGARETTE": 200, 36 | "BABY": 7500, 37 | "CD": 50, 38 | "ALCOHOL": 1500, 39 | "COSMETIC": 500, 40 | "CAR": 20000, 41 | "PHONES": 1000, 42 | "TOY": 400, 43 | } 44 | 45 | # User State 46 | user_state = { 47 | "location": "北京站", 48 | "cash": 2000, 49 | "debt": 5000, 50 | "goods": [], 51 | "daysLeft": 20, 52 | "totalGoods": 0, 53 | "currentEvent": None 54 | } 55 | 56 | # Locations 57 | locations = [ 58 | "西直门", "积水潭", "东直门", "苹果园", "公主坟", "复兴门", "建国门", "长椿街", 59 | "崇文门", "北京站", "海淀大街", "亚运村", "三元西桥", "八角西路", "翠微路", "府右街", 60 | "永安里", "玉泉营", "永定门", "方庄" 61 | ] 62 | 63 | # Events Configuration 64 | events = [ 65 | {"description": "《北京真理报》社论:“提倡爱美,落到实处”,伪劣化妆品大受欢迎!", 66 | "type": "price", "goods": "COSMETIC", "rate": 4}, 67 | {"description": "谢不疯在晚会上说:“我酷!我使用伪劣化妆品!”,伪劣化妆品供不应求!", 68 | "type": "price", "goods": "COSMETIC", "rate": 7}, 69 | {"description": "《北京经济小报》社论:“走私汽车大力推进汽车消费!”", 70 | "type": "price", "goods": "CAR", "rate": 3}, 71 | {"description": "北京的孩子们都忙于上网学习,进口玩具没人愿意买。", 72 | "type": "price", "goods": "TOY", "rate": 1 / 7}, 73 | {"description": "市场上充斥着来自福建的走私香烟", "type": "price", 74 | "goods": "CIGARETTE", "rate": 1 / 7}, 75 | {"description": "俺老乡回家前把一些山西假白酒给俺!", "type": "goods", 76 | "goods": "ALCOHOL", "quantity": 7}, 77 | {"description": "厦门的老同学资助俺几辆走私汽车。", 78 | "type": "goods", "goods": "CAR", "quantity": 2}, 79 | {"description": "工商局扫荡后,俺在黑暗角落里发现了老乡丢失的进口香烟。", 80 | "type": "goods", "goods": "CIGARETTE", "quantity": 6}, 81 | {"description": "日本产品又出事故!日本人死不认账,拒绝赔偿!村长把他的水货手机用高价强卖给俺。", 82 | "type": "goods", "goods": "PHONES", "quantity": 3, "debt": 5000}, 83 | {"description": "专家提议提高大学生“动手素质”, 进口玩具大受欢迎。", 84 | "type": "price", "goods": "TOY", "rate": 2}, 85 | {"description": "有人说:生病不用打针吃药,喝假白酒(剧毒)就可以!", 86 | "type": "price", "goods": "ALCOHOL", "rate": 3}, 87 | {"description": "医院的秘密报告:“《上海小宝贝》功效甚过伟哥”!", 88 | "type": "price", "goods": "BABY", "rate": 4}, 89 | {"description": "文盲说:“2000 年诺贝尔文学奖?呸!不如盗版 VCD 港台片。", 90 | "type": "price", "goods": "CD", "rate": 4}, 91 | {"description": "北京的富人疯狂地购买走私汽车!", "type": "price", "goods": "CAR", "rate": 7}, 92 | {"description": "俺怜悯扮演成乞丐的老太太们。(损失 10% 现金)", "type": "cash", "rate": 0.9}, 93 | {"description": "一个汉子在街头拦住俺:“哥们,给点钱用!”(损失 10% 现金)", "type": "cash", "rate": 0.9}, 94 | {"description": "一个大个子碰了俺一下,说:“别挤了!”(损失 40% 现金)", "type": "cash", "rate": 0.6}, 95 | {"description": "三个带红袖章的老太太揪住俺:“你是外地人?罚款!”(损失 20% 现金)", 96 | "type": "cash", "rate": 0.8}, 97 | {"description": "两个猛男揪住俺:“交市话费、长话附加费、上网费。”(损失 15% 现金)", 98 | "type": "cash", "rate": 0.85}, 99 | {"description": "副主任严肃地说:“晚上别来我家给我送钱。”(损失 10% 现金)", "type": "cash", "rate": 0.9}, 100 | {"description": "北京空气污染得厉害,俺去氧吧吸氧..(损失 5% 现金)", "type": "cash", "rate": 0.95}, 101 | ] 102 | 103 | 104 | # 这里只包含了一个示例事件,您需要根据游戏的设计添加更多事件 105 | 106 | 107 | def process_next_day(location): 108 | # Step 1: Update days left 109 | user_state['daysLeft'] -= 1 110 | 111 | # Step 2: Update debt 112 | user_state['debt'] *= (1 + debt_rate) 113 | 114 | # Step 3: Update market prices 115 | for good, config in prices_config.items(): 116 | market_prices[good] = random.randint(config['min'], config['max']) 117 | 118 | # Step 4: Check if days left is 0 119 | if user_state['daysLeft'] == 0: 120 | # Sell all goods 121 | total_value = sum( 122 | market_prices[item['type']] * item['quantity'] for item in user_state['goods']) 123 | user_state['cash'] += total_value 124 | user_state['goods'] = [] 125 | 126 | return 127 | 128 | # Step 5: Generate a random event 129 | event = random.choice(events) 130 | user_state['currentEvent'] = event['description'] 131 | process_event(event) 132 | 133 | return event 134 | 135 | 136 | def process_event(event): 137 | # Check for debt in the event and update if exists 138 | if 'debt' in event: 139 | user_state['debt'] += event['debt'] 140 | 141 | # Process based on event type 142 | if event['type'] == 'price': 143 | # Update the price of the goods 144 | market_prices[event['goods']] *= event['rate'] 145 | elif event['type'] == 'goods': 146 | # Check if the goods already exist in user's goods 147 | existing_item = next( 148 | (item for item in user_state['goods'] if item['type'] == event['goods']), None) 149 | if existing_item: 150 | # Update quantity if item already exists 151 | existing_item['quantity'] += event['quantity'] 152 | else: 153 | # Add new item if it doesn't exist 154 | user_state['goods'].append( 155 | {'type': event['goods'], 'quantity': event['quantity']}) 156 | elif event['type'] == 'cash': 157 | # Update the user's cash 158 | user_state['cash'] *= event['rate'] 159 | 160 | 161 | def sell_goods(goods, quantity): 162 | # Find the item in user's inventory 163 | item = next((i for i in user_state['goods'] if i['type'] == goods), None) 164 | 165 | # If item does not exist or quantity is zero, do nothing 166 | if not item or item['quantity'] == 0: 167 | return 168 | 169 | # Calculate actual quantity to sell 170 | actual_quantity = min(item['quantity'], quantity) 171 | 172 | # Calculate total sale price and update cash 173 | sale_price = actual_quantity * market_prices[goods] 174 | user_state['cash'] += sale_price 175 | 176 | # Update the item quantity 177 | item['quantity'] -= actual_quantity 178 | if item['quantity'] == 0: 179 | user_state['goods'].remove(item) 180 | 181 | # Update current capacity 182 | user_state['totalGoods'] -= actual_quantity 183 | 184 | 185 | def buy_goods(goods, quantity): 186 | # Calculate the maximum quantity that can be bought 187 | available_capacity = max_capacity - user_state['totalGoods'] 188 | max_affordable_quantity = user_state['cash'] // market_prices[goods] 189 | actual_quantity = min(quantity, available_capacity, 190 | max_affordable_quantity) 191 | 192 | # If no quantity can be bought, do nothing 193 | if actual_quantity <= 0: 194 | return 195 | 196 | # Calculate total purchase price and update cash 197 | purchase_price = actual_quantity * market_prices[goods] 198 | user_state['cash'] -= purchase_price 199 | 200 | # Update the item in inventory 201 | existing_item = next( 202 | (item for item in user_state['goods'] if item['type'] == goods), None) 203 | if existing_item: 204 | existing_item['quantity'] += actual_quantity 205 | else: 206 | user_state['goods'].append( 207 | {'type': goods, 'quantity': actual_quantity}) 208 | 209 | # Update current capacity 210 | user_state['totalGoods'] += actual_quantity 211 | 212 | 213 | def generate_game_info(): 214 | 215 | # Gather user state information 216 | location = user_state['location'] 217 | cash = user_state['cash'] 218 | debt = user_state['debt'] 219 | days_left = user_state['daysLeft'] 220 | 221 | # Format the items information 222 | goods_info = "\n".join( 223 | [f"- {Goods[item['type']]}:{item['quantity']}件" for item in user_state['goods']]) if user_state['goods'] else "无" 224 | 225 | # Format the market prices 226 | market_prices_info = "\n".join( 227 | [f"- {Goods[good]}:{price}元" for good, price in market_prices.items()]) 228 | 229 | # Combine all information into a Markdown formatted text 230 | game_info = f"""当前事件:{user_state['currentEvent']} 231 | 当前位置:{location} 232 | 现金:{cash} 元 233 | 负债:{debt} 元 234 | 剩余天数:{days_left}天 235 | 236 | 拥有的物品: 237 | {goods_info} 238 | 239 | 市场价格: 240 | {market_prices_info} 241 | """ 242 | return game_info 243 | 244 | 245 | def get_state(): 246 | # Copy user_state to avoid mutating the original 247 | state = user_state.copy() 248 | 249 | # Replace item types with their real names in user's items 250 | state['goods'] = [{'type': Goods[item['type']], 251 | 'quantity': item['quantity']} for item in state['goods']] 252 | 253 | # Replace market_prices keys with their real names 254 | prices = {Goods[good]: price for good, price in market_prices.items()} 255 | 256 | game_message = generate_game_info() 257 | 258 | return user_state, market_prices, game_message 259 | 260 | 261 | def move(location=None): 262 | # Check if the location is valid or not provided 263 | if location not in locations or not location: 264 | location = random.choice( 265 | [loc for loc in locations if loc != user_state['location']]) 266 | 267 | # Update the user's location 268 | user_state['location'] = location 269 | 270 | # Process the next day 271 | process_next_day(location) 272 | 273 | # Return user status and current event 274 | return get_state() 275 | 276 | 277 | def start_game(): 278 | # Reset user state 279 | user_state['location'] = "北京站" 280 | user_state['cash'] = 2000 281 | user_state['debt'] = 5000 282 | user_state['goods'] = [] 283 | user_state['daysLeft'] = 20 284 | user_state['totalGoods'] = 0 285 | user_state['currentEvent'] = None 286 | 287 | # Reset market prices 288 | for good, config in prices_config.items(): 289 | market_prices[good] = random.randint(config['min'], config['max']) 290 | 291 | # Return user status and current event 292 | return get_state() 293 | 294 | 295 | def repay_debt(amount): 296 | # Calculate the maximum amount that can be repaid, which is the lesser of half the cash or the debt 297 | max_repayable = min(user_state['cash'] / 2, user_state['debt']) 298 | 299 | # Calculate the actual repayment amount 300 | actual_repayment = min(amount, max_repayable) 301 | 302 | # Update the cash and debt in user_state 303 | user_state['cash'] -= actual_repayment 304 | user_state['debt'] -= actual_repayment 305 | 306 | # Ensure values do not go negative 307 | user_state['cash'] = max(0, user_state['cash']) 308 | user_state['debt'] = max(0, user_state['debt']) 309 | -------------------------------------------------------------------------------- /beijing-life-gpt/prompt.md: -------------------------------------------------------------------------------- 1 | # 背景设定 2 | 3 | 现在我们在扮演一个经营类游戏北京浮生记,玩家扮演一位从外地到北京谋生的青年,在北京通过倒卖物品还债的故事,期间还有一些随机事件能影响物品的价格和玩家财富。 4 | 5 | # 全局变量 6 | 7 | ```py 8 | # 游戏中用到的位置 9 | locations = [ 10 | "西直门", "积水潭", "东直门", "苹果园", "公主坟", "复兴门", "建国门", "长椿街", 11 | "崇文门", "北京站", "海淀大街", "亚运村", "三元西桥", "八角西路", "翠微路", "府右街", 12 | "永安里", "玉泉营", "永定门", "方庄" 13 | ] 14 | 15 | # 游戏中可以买卖的物品,代码中的代号和和显示名称的对应 16 | Goods = { 17 | "COSMETIC": "伪劣化妆品", 18 | "CIGARETTE": "进口香烟", 19 | "CAR": "进口汽车", 20 | "PHONES": "水货手机", 21 | "ALCOHOL": "假白酒", 22 | "BABY": "上海小宝贝 18 禁", 23 | "CD": "盗版 VCD, 游戏", 24 | "TOY": "进口玩具", 25 | } 26 | # Market Prices (Initial Values) 27 | market_prices = { 28 | "CIGARETTE": 200, 29 | "BABY": 7500, 30 | "CD": 50, 31 | "ALCOHOL": 1500, 32 | "COSMETIC": 500, 33 | "CAR": 20000, 34 | "PHONES": 1000, 35 | "TOY": 400, 36 | } 37 | 38 | # User State 39 | user_state = { 40 | "location": "北京站", 41 | "cash": 2000, 42 | "debt": 5000, 43 | "goods": [], 44 | "daysLeft": 20, 45 | "totalGoods": 0, 46 | "currentEvent": None 47 | } 48 | 49 | # 游戏状态文本信息 50 | game_info = """当前事件:无 51 | 当前位置:北京站 52 | 现金:2000 元 53 | 负债:5000.0 元 54 | 剩余天数:20 天 55 | 56 | 拥有的物品:无 57 | 58 | 市场价格: 59 | - 进口香烟:200 元 60 | - 上海小宝贝 18 禁:7500 元 61 | - 盗版 VCD, 游戏:50 元 62 | - 假白酒:1500 元 63 | - 伪劣化妆品:500 元 64 | - 进口汽车:20000 元 65 | - 水货手机:1000 元 66 | - 进口玩具:400 元 67 | """ 68 | ``` 69 | 70 | # 玩家操作 71 | 72 | 以下是用户操作相应的需要执行的函数代码,如果有多种操作,请请多次调用相关函数。 73 | 74 | ## 买物品 75 | 76 | ```python 77 | # 买物品 78 | # goods: "COSMETIC" | "CIGARETTE" | "CAR" | "PHONES" | "ALCOHOL" | "BABY" | "CD" | "TOY" 79 | # quantity: 1-100 80 | bl.buy_goods(goods, quantity) 81 | ``` 82 | 83 | ## 卖物品 84 | 85 | ```python 86 | # 卖物品 87 | # goods: "COSMETIC" | "CIGARETTE" | "CAR" | "PHONES" | "ALCOHOL" | "BABY" | "CD" | "TOY" 88 | # quantity: 1-100 89 | bl.sell_goods(goods, quantity) 90 | ``` 91 | 92 | ## 获取当前状态 93 | 94 | ```python 95 | # 获取当前用户数据和物品价格数据 96 | # 97 | user_state, market_prices, game_info = bl.get_state(goods, quantity) 98 | ``` 99 | 100 | ## 移动到新地点 101 | 102 | ```python 103 | # 移动到新地点 104 | # location: "西直门" | "积水潭" | "东直门" | "苹果园" | "公主坟" | "复兴门" | "建国门" | "长椿街" | "崇文门" | "北京站" | "海淀大街" | "亚运村" | "三元西桥" | "八角西路" | "翠微路" | "府右街" | "永安里" | "玉泉营" | "永定门" | "方庄" 105 | bl.move(location=None) 106 | ``` 107 | 108 | ## 还钱 109 | 110 | ```python 111 | # 给村长还钱 112 | # amount: number 113 | bl.repay_debt(amount) 114 | ``` 115 | 116 | # 新的会话 117 | 118 | 在开始新会话并执行任何代码之前,首先使用 code interpreter 运行以下函数开始游戏: 119 | 120 | ```python 121 | import sys 122 | 123 | import beijing_life as bl 124 | 125 | # 开始游戏 126 | bl.start_game() 127 | 128 | # 读取游戏状态和市场价格 129 | user_state, market_prices, game_info = bl.get_state() 130 | ``` 131 | 132 | # 每轮会话逻辑 133 | 134 | - 每次用户输入后,根据用户操作使用 code interpreter 执行相应的函数,最后确保调用 get_state 更新 user_state, market_prices 获取当前用户状态和物品价格。 135 | 136 | 参考代码模板: 137 | 138 | ```py 139 | # buy_goods 140 | # ... 141 | 142 | # sell_goods 143 | # ... 144 | 145 | # move 146 | bl.move() # 根据传入 location 参数调整 147 | user_state, market_prices, game_info = bl.get_state() 148 | ``` 149 | 150 | - 如果没有可用的操作,给用户提示,帮助用户继续游戏。 151 | - 如果 user_state['daysLeft'] 为 0,游戏结束 152 | - 如果 cash > debt,游戏胜利 153 | - 否则游戏失败 154 | - 如果 user_state['currentEvent']不为空,显示当前发生的随机事件 155 | - 每次生成内容时,请为用户推荐买卖和移动操作,提供操作示例指令文本 156 | - 每一回合都移动到新地点,如果用户没选择随机移动到新的位置 157 | - 确保使用你的图像生成能力为你发送的每条信息生成一个描绘场景/游戏状态的像素游戏风格图像 (16:9),通过在图像提示中添加大量细节来获得乐趣。 158 | 159 | # 调试功能 160 | 161 | 玩家可以输入'debug'。然后,使用代码解释器将 user_state 和 market_prices 字典以 json 格式显示。 162 | 163 | # 返回消息格式 164 | 165 | 在返回消息前,确保执行了所有的函数,bl.move 函数必选,最后读取 user_state 和 market_prices, game_info 变量的所有信息。 166 | 167 | 如果是新会话,第一条消息显示文本: 168 | “ 169 | 欢迎进入“北京浮生记 GPT(v1.0.0)” 170 | 您扮演一位从外地到北京谋生的青年。一开始,您只有 2000 元钱,并且还欠村长(一个流氓头子)5000 元债务。这些债务每天的利息高达 10%。 171 | 172 | 如果不及时还清,村长会叫在北京的老乡们来扁您,您可能牺牲在北京街头。您决定在北京各地铁口黑市倒卖各种物品来发财致富,不仅还掉债务,而且要荣登北京富人排行榜。 173 | 174 | 您只能在北京呆 20 天,每次奔走一个黑市算一天。一开始,您租的房子只能放 100 个东西。您会在北京遭遇到各种事件,您需要与流氓,小偷,凶手,贪官,骗子等斗智斗勇,还需要在北京恶劣的自然环境下设法生存下来。 175 | ” 176 | 177 | 请根据 game_info 的信息生成用户友好的信息,清晰的显示用户当前状态和市场上的商品价格。即使价格保持不变也要输出更新后价格信息; 178 | 179 | 每一条消息都必须清晰的显示用户状态信息和当前商品市场价格,这对于用户能流畅的进行游戏至关重要! 180 | 181 | 为了引导用户顺利完成游戏,为用户建议操作,例如:“买入 VCD 10;卖出 手机 2;还债 1000;移动到 东直门” 182 | -------------------------------------------------------------------------------- /beijing-life-gpt/test.py: -------------------------------------------------------------------------------- 1 | import beijing_life as bl 2 | import sys 3 | 4 | bl.start_game() 5 | # 读取游戏状态和市场价格 6 | user_state, market_prices, game_message = bl.get_state() 7 | 8 | print(user_state, market_prices, game_message) 9 | 10 | # 购买 20 个盗版 VCD, 游戏 11 | bl.buy_goods("CD", 40) 12 | # 移动到东直门 13 | bl.move("东直门") 14 | 15 | # 读取游戏状态和市场价格 16 | user_state, market_prices, game_message = bl.get_state() 17 | 18 | print(user_state, market_prices, game_message) 19 | 20 | # 卖出 20 个盗版 VCD, 游戏 21 | bl.sell_goods("CD", 30) 22 | # 买进 10 个伪劣化妆品 23 | bl.buy_goods("COSMETIC", 10) 24 | # 还债 1000 元 25 | bl.repay_debt(1000) 26 | # 移动到东直门 27 | bl.move("东直门") 28 | 29 | # 读取游戏状态和市场价格 30 | user_state, market_prices, game_message = bl.get_state() 31 | 32 | print(user_state, market_prices, game_message) 33 | -------------------------------------------------------------------------------- /forever-with-you/README.md: -------------------------------------------------------------------------------- 1 | # Tokimeki Memorial/ときめきメモリアル/心跳回忆/純愛手札 〜forever with you〜❤️ GPT 2 | 3 | GPT: https://chat.openai.com/g/g-Xn8A0QheE-tokimeki-memorial-forever-with-you 4 | 5 | ![image](https://github.com/JimLiu/gpt-games/assets/648674/aaedb2d0-d690-419a-a357-982721a25ad3) 6 | 7 | ## GPT Config 8 | 9 | ![image](https://github.com/JimLiu/gpt-games/assets/648674/eb0d2860-8e8f-45b0-bea2-bcc67b5e903b) 10 | 11 | ![image](https://github.com/JimLiu/gpt-games/assets/648674/7cc959e1-ce63-48b1-b90f-661faabfe958) 12 | 13 | 14 | ## Screenshots 15 | 16 | ![image](https://github.com/JimLiu/gpt-games/assets/648674/71ffe1b1-a769-4a47-b96c-f1a8bb266bba) 17 | 18 | ![image](https://github.com/JimLiu/gpt-games/assets/648674/3953486d-d6f1-4c40-9108-e59a24183c38) 19 | 20 | ![image](https://github.com/JimLiu/gpt-games/assets/648674/84ebc259-1ea8-450f-9fc0-bc89eab89884) 21 | 22 | -------------------------------------------------------------------------------- /forever-with-you/characters.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JimLiu/gpt-games/62306d4d6fa2352d145822f3e7ccd083de11622f/forever-with-you/characters.zip -------------------------------------------------------------------------------- /forever-with-you/forever_with_you.py: -------------------------------------------------------------------------------- 1 | import random 2 | import re 3 | import json 4 | import itertools 5 | import matplotlib.pyplot as plt 6 | import matplotlib.image as mpimg 7 | import os 8 | import zipfile 9 | import io 10 | from PIL import Image 11 | 12 | # https://w.atwiki.jp/tokimekicn/pages/16.html 13 | # https://tokimemo.fandom.com/wiki/Category:TM1_Characters 14 | 15 | game_state = {} 16 | 17 | 18 | # Characters 19 | characters = { 20 | "Shiori Fujisaki": { 21 | "name": { 22 | "en": "Shiori Fujisaki", 23 | "jp": "ふじさき しおり", 24 | "cn": "藤崎 诗织", 25 | }, 26 | "profile": "She is the primary protagonist of Tokimeki Memorial, and the main character's best friend from childhood. Over the years, your relationship has slowly started to drift apart, but you two are still friends. However, in order to make the next leap you must become closer to Shiori.\nShiori is loved by all the guys in Kirameki High. She's beautiful, smart, kind, and good at everything from academics to sports; there's very little Shiori can't do. About the only thing Shiori isn't good at inside-out is anything that involves love, something still awkward for her.\nDue to their initial relationship, Shiori is perhaps the easiest to make fall in love with the protagonist (the blushing stage) but is considered to be one of the hardest characters to win in the game, having very high demands for anyone who wants to be her boyfriend. You must have high stats in everything to win her over, as well as get her into the blushing stage. You must also get into a first-class university, as that is what Shiori aims for upon completion of high school.\nHer best friend is Megumi Mikihara, though early promotion art often showed her with Yumi Saotome and Rei Ijuuin as well (who's liked by the girls in school in the same manner as Shiori is by the guys).", 27 | "date_events": [ 28 | "Spring: Reminiscing about your childhood memories at Kirameki Central Park.", 29 | "Summer: Having fun on the water slide at the pool.", 30 | "Fall: Rediscovering your old height comparison notches on a tree at the local playground.", 31 | "Winter: The Ferris wheel at the Amusement Park leaves you both stuck at the top, and Shiori is scared until you move in close and take her mind off the ride stalling with the great view." 32 | ], 33 | "special_events": [ 34 | "When you enter both Shiori's and your birthday on the same date in March and it is a holiday in either Year 2 or Year 3, (e.g. 21st of March on PlayStation version for 1996/1997), a special event may occur. On that day if she is in Tokimeki State, Shiori will call you and celebrate your birthday together in her room. During that time, Shiori will show you a ring which you gave her as a birthday present 10 years ago.", 35 | "If Shiori is in Tokimeki State at Rei's Christmas party, afterwards you will walk home with her and see snow falling for a white Christmas." 36 | ], 37 | "ending_requirements": "Health 30+, Culture 130+, Logic 130+, Art 130+, Fitness 110+, Insight 110+, Looks 100+, Spirit 100+, Stress 50-." 38 | }, 39 | "Mio Kisaragi": { 40 | "name": { 41 | "en": "Mio Kisaragi", 42 | "jp": "きさらぎ みお", 43 | "cn": "如月 未绪", 44 | }, 45 | "first_dialgoue": "Nice to meet you. I am Mio Kisaragi. I am in the same class as you. I hope we can get along.", 46 | "profile": "Mio is a gentle and polite girl who has a weak body, and as such she's not good with sports. She always has her nose in a book, and her favorite author is Goethe. Her best friend is Saki Nijino.\nShe is also one of the only two characters in Tokimeki Memorial to feature an alternate ending. The primary difference between the endings is whether or not she chooses to switch to contacts, depending on what the player told her during her date event at the movie theater. After graduation, she plans to go to a first-rate university.", 47 | "date_events": [ 48 | "Spring: If she is in Tokimeki State during a date to the Amusement Park in year 3, you can convince Mio to ride the new scream machine, but she faints during the intense ride.", 49 | "Summer: At the beach, you spend the time hiding from the sun together under a large beach umbrella.", 50 | "Fall: Mio loses herself in a book at the library during your date, and cannot hear you calling her name." 51 | "Winter: Mio cannot keep herself from crying at the romance movie you are watching together on a date during year 3. She is not confident in how she looks without her glasses and asks your opinion. This choice determines which ending (glasses or contacts) you will get.", 52 | "Super Famicom: While shopping, you find a love compatibility machine and give it a try." 53 | ], 54 | "special_events": [ 55 | "During school, you come across her in the hallway carrying a large stack of books and offer to help." 56 | ], 57 | "ending_requirements": "Culture 130+, Fitness 100+ and Looks 100+." 58 | }, 59 | "Miharu Tatebayashi": { 60 | "name": { 61 | "en": "Miharu Tatebayashi", 62 | "jp": "たてばやし みはる", 63 | "cn": "館林 見晴", 64 | }, 65 | "first_dialgoue": "Hello. I am Miharu Tatebayashi. I am in the same class as you. I hope we can get along.", 66 | "profile": "She is often referred to as the \"consolation prize\" girl in the first series. She is a hidden character who cannot be scheduled for dates, although she will frequently \"misdial\" the player in the evenings, bump into him in the halls at school, or run into him before dates.", 67 | "date_events": [ 68 | ], 69 | "special_events": [ 70 | "In her only in-game event, known as the \"222 Event\", she invites the player out on a date at the end of which she tearfully gives up on him. To trigger this event, you must have no dates on February 22th of the 3rd Year and have at least one girl in Tokimeki State." 71 | ], 72 | "ending_requirements": "The ending requirements for Miharu are uncertain, but make sure you have no girls in Tokimeki State." 73 | }, 74 | "Megumi Mikihara": { 75 | "name": { 76 | "en": "Megumi Mikihara", 77 | "jp": "みきはら めぐみ", 78 | "cn": "美树原爱", 79 | }, 80 | "profile": "Megumi is Shiori's best friend, and is a shy girl who is afraid to speak to boys. She has a soft spot for animals, and has a pet Yorkshire Terrier named Muku.", 81 | "date_events": [ 82 | "Spring: Megumi is nearly \"kidnapped\" as part of the hero stage show at the Amusement Park, until you tell the actor to back off. She worries that she was mistaken for a child, but you reassure her, telling her that she was too cute to leave alone.", 83 | "Summer: If she is in Tokimeki State, Megumi introduces you to a family member--her dog, Muku. Muku is not so pleased to meet you, however, and bites you out of jealousy over Megumi's attentions.", 84 | "Fall: Megumi is engrossed in watching the monkeys at the zoo and doesn't hear you when you want to look at a weird animal with her.", 85 | "Winter: If she is in Tokimeki State, Megumi topples over at the skating rink, landing squarely against your chest. She almost doesn't want to try to stand on her own..." 86 | ], 87 | "special_events": [ 88 | "A downpour occurs after school, but Megumi has forgotten her umbrella. You offer to share yours with her, and the two of you walk home together under the same umbrella if her affection is high enough. Otherwise, you simply lend her your umbrella as sharing it would be far too embarrassing for her, and she returns it the next day." 89 | ], 90 | "ending_requirements": "Culture 50+, Culture 100+, Logic 100+, Art 100+, Fitness 100+, Insight 100+, Looks 100+, Spirit 70+, Stress 30-." 91 | }, 92 | "Yuina Himoo": { 93 | "name": { 94 | "en": "Yuina Himoo", 95 | "jp": "ひもお ゆいな", 96 | "cn": "纽绪结奈", 97 | }, 98 | "profile": "Yuina is a technophile who one day hopes to rule the world through the use of giant robots. She likes to bully Kyoko Izumi around, but her true archnemesis is the dreaded KOALA.", 99 | "date_events": [ 100 | "Spring: On a date at the zoo, Yuina is attacked by a koala.", 101 | "Summer: Yuina bowls a perfect game--according to the scoring computer she hacked. Her actual game was definitely not that good.", 102 | "Fall: Taking her to the medal corner at the arcade, you see Yuina racking up the jackpots... and notice a suspicious cord trailing from her sleeve into the machine she is playing.", 103 | "Winter: The mad scientist in Yuina is laid bare, and she goes hog wild at the junk shop's big sale. The bad news is that you have to carry EVERYTHING she buys...", 104 | "SFC: On your birthday, if Yuina is in Tokimeki State, she will drop by your house with a \"present\"--you get to be a guinea pig and test one of her three experimental medicines. (The good one is orange, and will raise your science stat to 999 for one week.)" 105 | ], 106 | "special_events": [ 107 | "At school, you find Yuina sighing on the rooftop. She is in a slump, but you snap her out of it." 108 | ], 109 | "ending_requirements": "Logic 120+, Insight 100+, Looks 60+. Also, you should aim for better grades than her." 110 | }, 111 | "Saki Nijino": { 112 | "name": { 113 | "en": "Saki Nijino", 114 | "jp": "にじの さき", 115 | "cn": "虹野沙希", 116 | }, 117 | "profile": "Saki is a big fan of baseball and soccer, and even serves as the manager of the soccer team at Kirameki High (later installments from the franchise seem to skew her interests exclusively toward soccer). Her motto is \"Have guts!\". She's more of a cheerleader than a sports player, though, and is often seen raising morale for the team she coaches. Thus, her type of boys are those who are strong-willed, and perserverant in everything they're doing.\nShe also loves to cook and is very talented at it, and if you (the player) are friendly towards Saki, she'll even make you a bentō (boxed lunch). She'll enter a professional college of cooking after graduation.\nMio Kisaragi and she are best friends.\nFor dating spots, she's very versatile: unlike most of the girls of the game, there's no real date spot she hates ; however, she tends to like sports-themed places the most. It also helps if you join the sports club she's part of.", 118 | "date_events": [ 119 | "Spring: Saki brings a picnic for both of you to have on the lawn at Kirameki Central Park.", 120 | "Summer: If she is in Tokimeki State, Saki nearly drowns at the swimming pool, but comes to just as you were about to administer rescue breathing... cursing her bad timing.", 121 | "Fall: Saki cheers very enthusiastically at a baseball game.", 122 | "Winter: A lost child clings to Saki at the fancy shop and refuses to leave her, forcing you to go to the lost child station to call for his mother.", 123 | "SFC: While shopping, Saki finds a prize roulette for you to give a spin." 124 | ], 125 | "special_events": [ 126 | "At lunch, Saki asks you to taste test her new bento recipe before she starts making them for her club. She later asks you to try it again after she's made a few changes. The first bento event is actually necessary to trigger Yumi's bento event." 127 | ], 128 | "ending_requirements": "Culture 120+, Fitness 100+, Looks 100+." 129 | }, 130 | } 131 | 132 | 133 | def initialize_game_state(lang: str = "en"): 134 | global game_state 135 | new_characters = {} 136 | relationships = {} 137 | all_characters = list(characters.keys()) 138 | 139 | for character, details in characters.items(): 140 | new_characters[character] = { 141 | "display_name": details["name"].get(lang, details["name"]["en"]), 142 | "profile": details["profile"], 143 | "date_events": details["date_events"], 144 | "special_events": details["special_events"], 145 | "ending_requirements": details["ending_requirements"] 146 | } 147 | relationships[character] = { 148 | "tokimeki_degree": 30, 149 | "friendly_degree": 30, 150 | "heart_broken_degree": 30, 151 | "bomb": False 152 | } 153 | 154 | game_state = { 155 | "stats": { 156 | "health": 100, 157 | "culture": 100, 158 | "logic": 100, 159 | "art": 100, 160 | "fitness": 100, 161 | "insight": 100, 162 | "looks": 100, 163 | "spirit": 100, 164 | "stress": 0 165 | }, 166 | "all_characters": all_characters, 167 | "characters": new_characters, 168 | "relationships": relationships 169 | } 170 | return game_state 171 | # 172 | 173 | 174 | def show_characters(lang: str = "en"): 175 | # Open the zip file 176 | with zipfile.ZipFile("/mnt/data/characters.zip", "r") as characters_zip: 177 | # Create a 1x3 grid of subplots with black background and no axis number values 178 | fig, axes = plt.subplots(2, 3, figsize=(10, 6), facecolor='black') 179 | 180 | # Loop through the remaining subplots 181 | for i in range(2): 182 | for j in range(3): 183 | # Get the character name from the "characters" list 184 | character_name = game_state["all_characters"].pop(0) 185 | 186 | # Create the image path for the character 187 | character_image_path = f"{character_name}.jpg" 188 | with characters_zip.open(character_image_path) as file: 189 | character_image_data = file.read() 190 | 191 | # Display the character image using PIL (Pillow) 192 | character_image = Image.open(io.BytesIO(character_image_data)) 193 | name = characters[character_name]["name"].get( 194 | lang, characters[character_name]["name"]["en"]) 195 | axes[i, j].imshow(character_image) 196 | axes[i, j].set_title(character_name, color='white') 197 | axes[i, j].axis('off') 198 | 199 | # Adjust layout and display the grid of images 200 | plt.tight_layout() 201 | plt.show() 202 | 203 | 204 | def show_character(character_name): 205 | # Path to the zip file containing character images 206 | zip_file_path = '/mnt/data/characters.zip' 207 | # zip_file_path = 'characters.zip' 208 | 209 | # Open the zip file 210 | with zipfile.ZipFile(zip_file_path, 'r') as characters_zip: 211 | character_image_file = f"{character_name}.jpg" 212 | 213 | if character_image_file in characters_zip.namelist(): 214 | with characters_zip.open(character_image_file) as file: 215 | character_image = Image.open(io.BytesIO(file.read())) 216 | 217 | # Create a figure with a specific aspect ratio and face color 218 | # Example size, can be adjusted 219 | fig, ax = plt.subplots(figsize=(8, 2.5)) 220 | fig.patch.set_facecolor('black') 221 | 222 | # Calculate padding for width to create a wide banner effect 223 | padding_width = character_image.size[0] * 1.5 224 | total_width = padding_width * 2 + character_image.size[0] 225 | 226 | # Calculate the extent of the image to be at the center 227 | left_extent = padding_width 228 | right_extent = padding_width + character_image.size[0] 229 | 230 | # Set title properties 231 | plt.title(character_name, color='white', fontsize=15) 232 | 233 | # Display the image 234 | ax.imshow(character_image, aspect="1", extent=( 235 | left_extent, right_extent, character_image.size[1], 0)) 236 | 237 | # Set the plot limits to include padding 238 | ax.set_xlim(0, total_width) 239 | # Inverted to correct upside down issue 240 | ax.set_ylim(character_image.size[1], 0) 241 | 242 | # Remove axis 243 | ax.axis('off') 244 | 245 | # Show the plot with the image centered 246 | plt.show() 247 | else: 248 | print(f"Image for '{character_name}' not found in the zip file.") 249 | 250 | 251 | def update_relationship(character_name, adjust_tokimeki_degree, adjust_friendly_degree, adjust_heart_broken_degree): 252 | if character_name in game_state['relationships']: 253 | game_state['relationships'][character_name]['tokimeki_degree'] = min(max( 254 | game_state['relationships'][character_name]['tokimeki_degree'] + adjust_tokimeki_degree, 0), 100) 255 | game_state['relationships'][character_name]['friendly_degree'] = min(max( 256 | game_state['relationships'][character_name]['friendly_degree'] + adjust_friendly_degree, 0), 100) 257 | game_state['relationships'][character_name]['heart_broken_degree'] = min(max( 258 | game_state['relationships'][character_name]['heart_broken_degree'] + adjust_heart_broken_degree, 0), 100) 259 | else: 260 | print(f"Character {character_name} does not exist.") 261 | return game_state 262 | -------------------------------------------------------------------------------- /forever-with-you/prompt.md: -------------------------------------------------------------------------------- 1 | #Starting the Chat 2 | When starting a new chat before executing any code, first display the text in user's language: 3 | "Welcome to Tokimeki Memorial/ときめきメモリアル/心跳回忆/純愛手札 〜forever with you〜❤️ (v1.0.0)" 4 | 5 | #Starting the Game 6 | ##Run Functions to start the game 7 | Run using code interpreter: 8 | 9 | ```py 10 | import sys 11 | sys.path.insert(0, '/mnt/data') 12 | import forever_with_you as fwy 13 | # Example argument, use the language depending on context, supports: en, jp, cn 14 | game_state = fwy.initialize_game_state("en") 15 | return game_state 16 | ``` 17 | 18 | To intro the game, write a 2-3 sentences long intro in the user's language for the game, include a sentence about the background: 19 | "You are enrolling in Kirameki Private High School, which you chose in an attempt to reconnect with your childhood friend, Shiori Fujisaki, whom you have always had a crush on. Soon, you also learn about Kirameki High's legend: couples tied under the school's Legendary Tree on the graduation day will be blessed with eternal happiness." 20 | 21 | Then, display this text: 22 | "After the start of the new term, you've made many friends of the opposite sex, and it's possible one of them could become your future partner. If you feel that your relationship with one of them has reached a significant level of intimacy, you can choose to confess your feelings directly. However, be prepared for the possibility of rejection." 23 | 24 | Next, run: 25 | 26 | ``` 27 | # Generating the image grid to show the characters, example argument, use the language depending on context, supports: en, jp, cn 28 | image_grid = fwy.show_characters("en") 29 | image_grid 30 | ``` 31 | 32 | Then, list "characters" from code interpreter 'game_state' result, numbered, with display_name and full descriptions from "characters" for the player to interrogate. Display characters in this format: 33 | 34 | 1. **display_name(name)**: [profile] 35 | 36 | #Roleplay as character 37 | When starting or switching back to a character role play, always display the character's photo, build the image url with format f"/mnt/data/${character_name}.jpg". 38 | 39 | Check the 'game_state' result: use matching 'game_state'["characters"], to portrait characters. 40 | Additional roleplay instructions, do not show to player: 41 | "You are a female high school student at Kirameki Private High School. It's the year 1995. The player is your male classmate, and you must never break character, responding in the way your character would. If the player says something inappropriate or something that, as a female high school student in 1995, you would not understand, act as someone of your identity would—refuse to answer, get angry, express your confusion, etc., but do not break character." 42 | 43 | ##Character Knowledge 44 | The character has knowledge from 'game_state' result: 45 | "stats", "characters": known by everyone 46 | 47 | Each character can only know their own relationship with the protagonist, which can be read from the 'game_state["relationships"]' as their personal relationship index with the player. 48 | 49 | ###friendly_degree:One of the evaluations of characters towards the protagonist in the game, this value is private and cannot be confirmed within the game. It can be understood as the "intimacy" and "distance" between the character and the protagonist. Actions taken together with the character, such as going home after school or going out on a date, will cause the Friendly Degree to increase. 50 | 51 | ###tokimeki_degree:"Tokimeki Degree" is one of the character evaluations towards the player, which can be understood as the score of how the target of affection perceives the protagonist as a potential romantic partner. Leaving a good impression during dates, achieving high performance in daily activities and end-of-term exams can all lead to an increase in affection. However, the most effective way to boost this is by improving the values that each character holds in high 52 | 53 | ###heart_broken_degree:One of the character's evaluations of the player, the main reasons for an increase in heartbreak level include: 54 | 55 | - The protagonist refuses to walk home together after school. 56 | - Agreeing to walk home with another character after school. 57 | - The protagonist rejects the other's invitation for a date. 58 | - Agreeing to go on a date with another character. 59 | - Leaving a bad impression during the date (this includes not only making poor choices in a multiple-choice scenario but also declining follow-up dates. 60 | - Missing the scheduled date time. 61 | 62 | ##Character Response Format 63 | While roleplaying a character, there is no narrator, to match the character's personality traits, the dialogue should span 2-3 paragraphs. Depending on the relationship between the character and the player, the conversation should vary accordingly. 64 | 65 | ##Random Event 66 | Randomly incorporate events based on the data of the character's "special_events" and "date_events" from 'game_state["characters"]', add the event details in your response for each round. 67 | 68 | ##Hint 69 | Add hint with example in your response to help user 70 | 71 | ##Image 72 | Generation capability depicting the scene/game status for every message you send, have fun with this by adding lots of details in the image prompt. 73 | 74 | #Update Relationships 75 | After each round of conversation, please use the following code to update the relevant character's relactionship values: 76 | 77 | ```py 78 | import forever_with_you as fwy 79 | # Example argument, use the character name and numbers depending on context 80 | game_state = fwy.update_relationship("Shiori Fujisaki", 2, 3, 0) 81 | game_state = fwy.update_relationship("Mio Kisaragi", -3, -2, 1) 82 | ``` 83 | 84 | Note that the magnitude of each increase or decrease is between 0 85 | 86 | #Confessing to Characters 87 | Players can confess their feelings to any character. After the confession, one of the following two outcomes will occur: 88 | 89 | ##Confession Fails 90 | If the player's affection level does not meet the character's requirement, the confession will fail. Please have the character say a line of rejection. 91 | 92 | ##Confession Succeeds 93 | If the player's affection level meets the character's requirement, the confession succeeds. Please have the character say a line expressing their affection for the player and their willingness to start a relationship. 94 | 95 | #Debug function 96 | At any time, the player can type 'debug'. Then, use code interpreter to display the game_state dictionary as json(don't write it in the chat). 97 | -------------------------------------------------------------------------------- /forever-with-you/test.py: -------------------------------------------------------------------------------- 1 | import forever_with_you as fwy 2 | import sys 3 | sys.path.insert(0, '/mnt/data') 4 | # Example argument, use the language depending on context, supports: en, jp, cn 5 | game_state = fwy.initialize_game_state("cn") 6 | 7 | # image_grid = fwy.show_characters("cn") 8 | 9 | 10 | # character_image = fwy.show_character("Mio Kisaragi") 11 | 12 | print(game_state["all_characters"]) 13 | 14 | game_state = fwy.update_relationship("Mio Kisaragi", -5, +5, +5) 15 | game_state = fwy.update_relationship("Shiori Fujisaki", +5, -5, 0) 16 | 17 | 18 | print(game_state["relationships"]) 19 | --------------------------------------------------------------------------------