Skip to content

Instantly share code, notes, and snippets.

@hmhmsh
Last active May 17, 2019 10:19
Show Gist options
  • Save hmhmsh/fa9efdea29fcc854aaaf33ca8b9166d0 to your computer and use it in GitHub Desktop.
Save hmhmsh/fa9efdea29fcc854aaaf33ca8b9166d0 to your computer and use it in GitHub Desktop.
Saizeriya Menu List (2019.05.17時点) // jsonのsaltの桁数あとで修正予定
enum SaizeriyaMenuCategory: String, Codable {
case saladSoup = "サラダ・スープ"
case appetizer = "前菜・おつまみ"
case fromItalyWine = "イタリアの味・ワイン"
case pizza = "ピザ"
case pasta = "パスタ"
case doriaRice = "ドリア・米料理"
case hamburgSteak = "肉料理"
case dessert = "デザート"
var list: [SaizeriyaMenuCategory] {
return [.saladSoup, .appetizer, .fromItalyWine, .pizza, .pasta, .doriaRice, .hamburgSteak, .dessert]
}
}
[{"kcal":130,"salt":1.1000000238418579,"name":"彩りガーデンサラダ","category":"サラダ・スープ","price":299},{"kcal":115,"salt":1.2999999523162842,"name":"小エビのサラダ","category":"サラダ・スープ","price":349},{"kcal":134,"salt":1.2000000476837158,"name":"やわらかチキンサラダ","category":"サラダ・スープ","price":299},{"kcal":196,"salt":0.69999998807907104,"name":"イタリアンサラダ","category":"サラダ・スープ","price":299},{"kcal":92,"salt":2.0999999046325684,"name":"わかめサラダ","category":"サラダ・スープ","price":299},{"kcal":229,"salt":2.4000000953674316,"name":"シーフードサラダ","category":"サラダ・スープ","price":599},{"kcal":433,"salt":2.2999999523162842,"name":"半熟卵とポークのサラダ","category":"サラダ・スープ","price":599},{"kcal":142,"salt":1.1000000238418579,"name":"コーンクリームスープ","category":"サラダ・スープ","price":149},{"kcal":105,"salt":0.89999997615814209,"name":"冷たいパンプキンスープ","category":"サラダ・スープ","price":149},{"kcal":222,"salt":2.0999999046325684,"name":"たっぷり野菜のミネストローネ","category":"サラダ・スープ","price":299},{"kcal":374,"salt":2.2000000476837158,"name":"辛味チキン","category":"前菜・おつまみ","price":299},{"kcal":221,"salt":1.1000000238418579,"name":"アスパラガスのオーブン焼き","category":"前菜・おつまみ","price":299},{"kcal":215,"salt":1.3999999761581421,"name":"ポップコーンシュリンプ","category":"前菜・おつまみ","price":299},{"kcal":256,"salt":1.5,"name":"エスカルゴのオーブン焼き","category":"前菜・おつまみ","price":399},{"kcal":164,"salt":1.2999999523162842,"name":"ムール貝のガーリック焼き","category":"前菜・おつまみ","price":399},{"kcal":570,"salt":3.0999999046325684,"name":"野菜ソースのグリルソーセージ","category":"前菜・おつまみ","price":399},{"kcal":393,"salt":2,"name":"チョリソー","category":"前菜・おつまみ","price":399},{"kcal":213,"salt":1.1000000238418579,"name":"柔らか青豆の温サラダ","category":"前菜・おつまみ","price":199},{"kcal":59,"salt":0.60000002384185791,"name":"削りたてペコリーノチーズ","category":"前菜・おつまみ","price":100},{"kcal":52,"salt":1.2999999523162842,"name":"セロリのピクルス","category":"前菜・おつまみ","price":199},{"kcal":138,"salt":1.1000000238418579,"name":"真イカのパプリカソース","category":"前菜・おつまみ","price":199},{"kcal":138,"salt":1.2000000476837158,"name":"ほうれん草のソテー","category":"前菜・おつまみ","price":199},{"kcal":80,"salt":1.5,"name":"キャベツとアンチョビのソテー","category":"前菜・おつまみ","price":199},{"kcal":366,"salt":2,"name":"ポテトのグリル","category":"前菜・おつまみ","price":199},{"kcal":252,"salt":1.1000000238418579,"name":"ガーリックトースト","category":"前菜・おつまみ","price":189},{"kcal":188,"salt":1,"name":"ミニフィセル","category":"前菜・おつまみ","price":169},{"kcal":214,"salt":0.80000001192092896,"name":"フォッカチオ","category":"前菜・おつまみ","price":119},{"kcal":214,"salt":0.80000001192092896,"name":"プチフォッカ","category":"前菜・おつまみ","price":139},{"kcal":95,"salt":1.1000000238418579,"name":"熟成ミラノサラミ","category":"イタリアの味・ワイン","price":299},{"kcal":190,"salt":2.2000000476837158,"name":"熟成ミラノサラミ(Wサイズ)","category":"イタリアの味・ワイン","price":598},{"kcal":203,"salt":0.40000000596046448,"name":"フレッシュチーズとトマトのサラダ","category":"イタリアの味・ワイン","price":299},{"kcal":406,"salt":0.80000001192092896,"name":"フレッシュチーズとトマトのサラダ(Wサイズ)","category":"イタリアの味・ワイン","price":598},{"kcal":162,"salt":1.7999999523162842,"name":"プロシュート","category":"イタリアの味・ワイン","price":399},{"kcal":324,"salt":3.5999999046325684,"name":"プロシュート(Wサイズ)","category":"イタリアの味・ワイン","price":798},{"kcal":0,"salt":0,"name":"フレッシュワインマグナム1500ml","category":"イタリアの味・ワイン","price":1080},{"kcal":0,"salt":0,"name":"フレッシュワインデカンタ500ml","category":"イタリアの味・ワイン","price":399},{"kcal":0,"salt":0,"name":"フレッシュワインデカンタ250ml","category":"イタリアの味・ワイン","price":200},{"kcal":0,"salt":0,"name":"フレッシュワイングラスワイン","category":"イタリアの味・ワイン","price":100},{"kcal":0,"salt":0,"name":"グラッパ","category":"イタリアの味・ワイン","price":379},{"kcal":0,"salt":0,"name":"ランブルスコセッコ","category":"イタリアの味・ワイン","price":1080},{"kcal":0,"salt":0,"name":"ランブルスコ","category":"イタリアの味・ワイン","price":1080},{"kcal":0,"salt":0,"name":"ベルデッキオ","category":"イタリアの味・ワイン","price":1080},{"kcal":0,"salt":0,"name":"キャンティ","category":"イタリアの味・ワイン","price":1080},{"kcal":0,"salt":0,"name":"キャンティルナファ リゼルバ","category":"イタリアの味・ワイン","price":2160},{"kcal":0,"salt":0,"name":"サイゼリヤプレミアム","category":"イタリアの味・ワイン","price":2160},{"kcal":575,"salt":2.2999999523162842,"name":"バッファローモッツァレラのピザ","category":"ピザ","price":499},{"kcal":566,"salt":2.5,"name":"マルゲリータピザ","category":"ピザ","price":399},{"kcal":646,"salt":2.9000000953674316,"name":"パンチェッタのピザ","category":"ピザ","price":399},{"kcal":610,"salt":2.7000000476837158,"name":"野菜ときのこのピザ","category":"ピザ","price":399},{"kcal":606,"salt":3.5,"name":"ミラノサラミのピザ","category":"ピザ","price":499},{"kcal":593,"salt":4.5999999046325684,"name":"柔らかイカとアンチョビのピザ","category":"ピザ","price":499},{"kcal":560,"salt":3.2000000476837158,"name":"アーリオ・オーリオ","category":"パスタ","price":299},{"kcal":1120,"salt":6.4000000953674316,"name":"アーリオ・オーリオ(Wサイズ)","category":"パスタ","price":574},{"kcal":582,"salt":4.3000001907348633,"name":"ミートソースボロニア風","category":"パスタ","price":399},{"kcal":1164,"salt":8.6000003814697266,"name":"ミートソースボロニア風(Wサイズ)","category":"パスタ","price":770},{"kcal":605,"salt":3.7000000476837158,"name":"タラコソースシシリー風","category":"パスタ","price":399},{"kcal":1210,"salt":7.4000000953674316,"name":"タラコソースシシリー風(Wサイズ)","category":"パスタ","price":770},{"kcal":686,"salt":3.5,"name":"キャベツのペペロンチーノ","category":"パスタ","price":399},{"kcal":1372,"salt":7,"name":"キャベツのペペロンチーノ(Wサイズ)","category":"パスタ","price":770},{"kcal":591,"salt":4.1999998092651367,"name":"アラビアータ","category":"パスタ","price":399},{"kcal":1182,"salt":8.3999996185302734,"name":"アラビアータ(Wサイズ)","category":"パスタ","price":770},{"kcal":686,"salt":4.8000001907348633,"name":"スープ入りトマト味ボンゴレ","category":"パスタ","price":499},{"kcal":1372,"salt":9.6000003814697266,"name":"スープ入りトマト味ボンゴレ(Wサイズ)","category":"パスタ","price":976},{"kcal":700,"salt":4.1999998092651367,"name":"パルマ風スパゲッティ","category":"パスタ","price":399},{"kcal":1400,"salt":8.3999996185302734,"name":"パルマ風スパゲッティ(Wサイズ)","category":"パスタ","price":770},{"kcal":711,"salt":3.5,"name":"アスパラガスとエビのクリームスパゲッティ","category":"パスタ","price":499},{"kcal":1422,"salt":7,"name":"アスパラガスとエビのクリームスパゲッティ(Wサイズ)","category":"パスタ","price":770},{"kcal":865,"salt":4.0999999046325684,"name":"カルボナーラ","category":"パスタ","price":499},{"kcal":1730,"salt":8.1999998092651367,"name":"カルボナーラ(Wサイズ)","category":"パスタ","price":770},{"kcal":610,"salt":3.7999999523162842,"name":"イカ墨入りスパゲッティ","category":"パスタ","price":499},{"kcal":1220,"salt":7.5999999046325684,"name":"イカ墨入りスパゲッティ(Wサイズ)","category":"パスタ","price":770},{"kcal":90,"salt":0.20000000298023224,"name":"トッピング半熟卵","category":"パスタ","price":69},{"kcal":542,"salt":2.7000000476837158,"name":"ミラノ風ドリア","category":"ドリア・米料理","price":299},{"kcal":590,"salt":3.0999999046325684,"name":"いろどり野菜のミラノ風ドリア","category":"ドリア・米料理","price":399},{"kcal":624,"salt":2.9000000953674316,"name":"エビとイカのドリア","category":"ドリア・米料理","price":499},{"kcal":521,"salt":1.8999999761581421,"name":"ほうれん草のグラタン","category":"ドリア・米料理","price":399},{"kcal":537,"salt":2.2999999523162842,"name":"シーフードグラタン","category":"ドリア・米料理","price":499},{"kcal":602,"salt":3.5999999046325684,"name":"シーフードパエリア","category":"ドリア・米料理","price":599},{"kcal":302,"salt":2.2000000476837158,"name":"エビと野菜のトマトクリームリゾット","category":"ドリア・米料理","price":399},{"kcal":638,"salt":3.2999999523162842,"name":"ハヤシ&ターメリックライス","category":"ドリア・米料理","price":499},{"kcal":823,"salt":3.7999999523162842,"name":"ミックスグリル","category":"肉料理","price":599},{"kcal":514,"salt":2.2999999523162842,"name":"ハンバーグステーキ","category":"肉料理","price":399},{"kcal":585,"salt":2.5999999046325684,"name":"野菜ソースのハンバーグ","category":"肉料理","price":499},{"kcal":628,"salt":3.5999999046325684,"name":"デミグラスソースのハンバーグ","category":"肉料理","price":499},{"kcal":633,"salt":2.5,"name":"イタリアンハンバーグ","category":"肉料理","price":499},{"kcal":709,"salt":3.4000000953674316,"name":"焼肉とハンバーグの盛合せ","category":"肉料理","price":599},{"kcal":541,"salt":2.0999999046325684,"name":"若鶏のグリル","category":"肉料理","price":499},{"kcal":588,"salt":2,"name":"柔らかチキンのチーズ焼き","category":"肉料理","price":499},{"kcal":663,"salt":2.5,"name":"パンチェッタと若鶏のグリル","category":"肉料理","price":599},{"kcal":303,"salt":0,"name":"ライス","category":"肉料理","price":169},{"kcal":454,"salt":0,"name":"ラージライス","category":"肉料理","price":219},{"kcal":151,"salt":0,"name":"スモールライス","category":"肉料理","price":119},{"kcal":114,"salt":0.10000000149011612,"name":"カプチーノ","category":"デザート","price":199},{"kcal":330,"salt":0.20000000298023224,"name":"プリンとカプチーノの盛合せ","category":"デザート","price":399},{"kcal":347,"salt":0.20000000298023224,"name":"プリンとティラミスの盛合せ","category":"デザート","price":399},{"kcal":131,"salt":0.10000000149011612,"name":"ティラミス","category":"デザート","price":199},{"kcal":246,"salt":0.80000001192092896,"name":"シナモンフォッカチオ","category":"デザート","price":169},{"kcal":346,"salt":0.89999997615814209,"name":"ミルクアイスのせシナモンフォッカチオ","category":"デザート","price":319},{"kcal":216,"salt":0.10000000149011612,"name":"イタリアンプリン","category":"デザート","price":249},{"kcal":162,"salt":0.10000000149011612,"name":"コーヒーゼリー","category":"デザート","price":299},{"kcal":164,"salt":0.10000000149011612,"name":"トリフアイスクリーム","category":"デザート","price":369},{"kcal":199,"salt":0.10000000149011612,"name":"ミルクジェラート","category":"デザート","price":199},{"kcal":127,"salt":0,"name":"シチリア産レモンのソルベ","category":"デザート","price":199},{"kcal":166,"salt":0.10000000149011612,"name":"チョコレートケーキ","category":"デザート","price":299}]
struct SaizeriyaMenu: Codable {
let category: SaizeriyaMenuCategory
var name: String
// [円]
var price: Int
// [kcal]
var kcal: Int
// [g]
var salt: Double
}
struct SaizeriyaMenuDatabase {
let saladSoup = [
SaizeriyaMenu(category: .saladSoup, name: "彩りガーデンサラダ", price: 299, kcal: 130, salt: 1.1),
SaizeriyaMenu(category: .saladSoup, name: "小エビのサラダ", price: 349, kcal: 115, salt: 1.3),
SaizeriyaMenu(category: .saladSoup, name: "やわらかチキンサラダ", price: 299, kcal: 134, salt: 1.2),
SaizeriyaMenu(category: .saladSoup, name: "イタリアンサラダ", price: 299, kcal: 196, salt: 0.7),
SaizeriyaMenu(category: .saladSoup, name: "わかめサラダ", price: 299, kcal: 92, salt: 2.1),
SaizeriyaMenu(category: .saladSoup, name: "シーフードサラダ", price: 599, kcal: 229, salt: 2.4),
SaizeriyaMenu(category: .saladSoup, name: "半熟卵とポークのサラダ", price: 599, kcal: 433, salt: 2.3),
SaizeriyaMenu(category: .saladSoup, name: "コーンクリームスープ", price: 149, kcal: 142, salt: 1.1),
SaizeriyaMenu(category: .saladSoup, name: "冷たいパンプキンスープ", price: 149, kcal: 105, salt: 0.9),
SaizeriyaMenu(category: .saladSoup, name: "たっぷり野菜のミネストローネ", price: 299, kcal: 222, salt: 2.1)
]
let appetizer = [
SaizeriyaMenu(category: .appetizer, name: "辛味チキン", price: 299, kcal: 374, salt: 2.2),
SaizeriyaMenu(category: .appetizer, name: "アスパラガスのオーブン焼き", price: 299, kcal: 221, salt: 1.1),
SaizeriyaMenu(category: .appetizer, name: "ポップコーンシュリンプ", price: 299, kcal: 215, salt: 1.4),
SaizeriyaMenu(category: .appetizer, name: "エスカルゴのオーブン焼き", price: 399, kcal: 256, salt: 1.5),
SaizeriyaMenu(category: .appetizer, name: "ムール貝のガーリック焼き", price: 399, kcal: 164, salt: 1.3),
SaizeriyaMenu(category: .appetizer, name: "野菜ソースのグリルソーセージ", price: 399, kcal: 570, salt: 3.1),
SaizeriyaMenu(category: .appetizer, name: "チョリソー", price: 399, kcal: 393, salt: 2.0),
SaizeriyaMenu(category: .appetizer, name: "柔らか青豆の温サラダ", price: 199, kcal: 213, salt: 1.1),
SaizeriyaMenu(category: .appetizer, name: "削りたてペコリーノチーズ", price: 100, kcal: 59, salt: 0.6),
SaizeriyaMenu(category: .appetizer, name: "セロリのピクルス", price: 199, kcal: 52, salt: 1.3),
SaizeriyaMenu(category: .appetizer, name: "真イカのパプリカソース", price: 199, kcal: 138, salt: 1.1),
SaizeriyaMenu(category: .appetizer, name: "ほうれん草のソテー", price: 199, kcal: 138, salt: 1.2),
SaizeriyaMenu(category: .appetizer, name: "キャベツとアンチョビのソテー", price: 199, kcal: 80, salt: 1.5),
SaizeriyaMenu(category: .appetizer, name: "ポテトのグリル", price: 199, kcal: 366, salt: 2.0),
SaizeriyaMenu(category: .appetizer, name: "ガーリックトースト", price: 189, kcal: 252, salt: 1.1),
SaizeriyaMenu(category: .appetizer, name: "ミニフィセル", price: 169, kcal: 188, salt: 1.0),
SaizeriyaMenu(category: .appetizer, name: "フォッカチオ", price: 119, kcal: 214, salt: 0.8),
SaizeriyaMenu(category: .appetizer, name: "プチフォッカ", price: 139, kcal: 214, salt: 0.8)
]
let fromItalyWine = [
SaizeriyaMenu(category: .fromItalyWine, name: "熟成ミラノサラミ", price: 299, kcal: 95, salt: 1.1),
SaizeriyaMenu(category: .fromItalyWine, name: "熟成ミラノサラミ(Wサイズ)", price: 598, kcal: 190, salt: 2.2),
SaizeriyaMenu(category: .fromItalyWine, name: "フレッシュチーズとトマトのサラダ", price: 299, kcal: 203, salt: 0.4),
SaizeriyaMenu(category: .fromItalyWine, name: "フレッシュチーズとトマトのサラダ(Wサイズ)", price: 598, kcal: 406, salt: 0.8),
SaizeriyaMenu(category: .fromItalyWine, name: "プロシュート", price: 399, kcal: 162, salt: 1.8),
SaizeriyaMenu(category: .fromItalyWine, name: "プロシュート(Wサイズ)", price: 798, kcal: 324, salt: 3.6),
SaizeriyaMenu(category: .fromItalyWine, name: "フレッシュワインマグナム1500ml", price: 1080, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "フレッシュワインデカンタ500ml", price: 399, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "フレッシュワインデカンタ250ml", price: 200, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "フレッシュワイングラスワイン", price: 100, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "グラッパ", price: 379, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "ランブルスコセッコ", price: 1080, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "ランブルスコ", price: 1080, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "ベルデッキオ", price: 1080, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "キャンティ", price: 1080, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "キャンティルナファ リゼルバ", price: 2160, kcal: 0, salt: 0),
SaizeriyaMenu(category: .fromItalyWine, name: "サイゼリヤプレミアム", price: 2160, kcal: 0, salt: 0)
]
let pizza = [
SaizeriyaMenu(category: .pizza, name: "バッファローモッツァレラのピザ", price: 499, kcal: 575, salt: 2.3),
SaizeriyaMenu(category: .pizza, name: "マルゲリータピザ", price: 399, kcal: 566, salt: 2.5),
SaizeriyaMenu(category: .pizza, name: "パンチェッタのピザ", price: 399, kcal: 646, salt: 2.9),
SaizeriyaMenu(category: .pizza, name: "野菜ときのこのピザ", price: 399, kcal: 610, salt: 2.7),
SaizeriyaMenu(category: .pizza, name: "ミラノサラミのピザ", price: 499, kcal: 606, salt: 3.5),
SaizeriyaMenu(category: .pizza, name: "柔らかイカとアンチョビのピザ", price: 499, kcal: 593, salt: 4.6)
]
/* Wサイズ
* 299 -> 574
* 399 -> 770
* 499 -> 976
*/
let pasta = [
SaizeriyaMenu(category: .pasta, name: "アーリオ・オーリオ", price: 299, kcal: 560, salt: 3.2),
SaizeriyaMenu(category: .pasta, name: "アーリオ・オーリオ(Wサイズ)", price: 574, kcal: 1120, salt: 6.4),
SaizeriyaMenu(category: .pasta, name: "ミートソースボロニア風", price: 399, kcal: 582, salt: 4.3),
SaizeriyaMenu(category: .pasta, name: "ミートソースボロニア風(Wサイズ)", price: 770, kcal: 1164, salt: 8.6),
SaizeriyaMenu(category: .pasta, name: "タラコソースシシリー風", price: 399, kcal: 605, salt: 3.7),
SaizeriyaMenu(category: .pasta, name: "タラコソースシシリー風(Wサイズ)", price: 770, kcal: 1210, salt: 7.4),
SaizeriyaMenu(category: .pasta, name: "キャベツのペペロンチーノ", price: 399, kcal: 686, salt: 3.5),
SaizeriyaMenu(category: .pasta, name: "キャベツのペペロンチーノ(Wサイズ)", price: 770, kcal: 1372, salt: 7.0),
SaizeriyaMenu(category: .pasta, name: "アラビアータ", price: 399, kcal: 591, salt: 4.2),
SaizeriyaMenu(category: .pasta, name: "アラビアータ(Wサイズ)", price: 770, kcal: 1182, salt: 8.4),
SaizeriyaMenu(category: .pasta, name: "スープ入りトマト味ボンゴレ", price: 499, kcal: 686, salt: 4.8),
SaizeriyaMenu(category: .pasta, name: "スープ入りトマト味ボンゴレ(Wサイズ)", price: 976, kcal: 1372, salt: 9.6),
SaizeriyaMenu(category: .pasta, name: "パルマ風スパゲッティ", price: 399, kcal: 700, salt: 4.2),
SaizeriyaMenu(category: .pasta, name: "パルマ風スパゲッティ(Wサイズ)", price: 770, kcal: 1400, salt: 8.4),
SaizeriyaMenu(category: .pasta, name: "アスパラガスとエビのクリームスパゲッティ", price: 499, kcal: 711, salt: 3.5),
SaizeriyaMenu(category: .pasta, name: "アスパラガスとエビのクリームスパゲッティ(Wサイズ)", price: 770, kcal: 1422, salt: 7.0),
SaizeriyaMenu(category: .pasta, name: "カルボナーラ", price: 499, kcal: 865, salt: 4.1),
SaizeriyaMenu(category: .pasta, name: "カルボナーラ(Wサイズ)", price: 770, kcal: 1730, salt: 8.2),
SaizeriyaMenu(category: .pasta, name: "イカ墨入りスパゲッティ", price: 499, kcal: 610, salt: 3.8),
SaizeriyaMenu(category: .pasta, name: "イカ墨入りスパゲッティ(Wサイズ)", price: 770, kcal: 1220, salt: 7.6),
SaizeriyaMenu(category: .pasta, name: "トッピング半熟卵", price: 69, kcal: 90, salt: 0.2)
]
let doriaRice = [
SaizeriyaMenu(category: .doriaRice, name: "ミラノ風ドリア", price: 299, kcal: 542, salt: 2.7),
SaizeriyaMenu(category: .doriaRice, name: "いろどり野菜のミラノ風ドリア", price: 399, kcal: 590, salt: 3.1),
SaizeriyaMenu(category: .doriaRice, name: "エビとイカのドリア", price: 499, kcal: 624, salt: 2.9),
SaizeriyaMenu(category: .doriaRice, name: "ほうれん草のグラタン", price: 399, kcal: 521, salt: 1.9),
SaizeriyaMenu(category: .doriaRice, name: "シーフードグラタン", price: 499, kcal: 537, salt: 2.3),
SaizeriyaMenu(category: .doriaRice, name: "シーフードパエリア", price: 599, kcal: 602, salt: 3.6),
SaizeriyaMenu(category: .doriaRice, name: "エビと野菜のトマトクリームリゾット", price: 399, kcal: 302, salt: 2.2),
SaizeriyaMenu(category: .doriaRice, name: "ハヤシ&ターメリックライス", price: 499, kcal: 638, salt: 3.3)
]
let hamburgSteak = [
SaizeriyaMenu(category: .hamburgSteak, name: "ミックスグリル", price: 599, kcal: 823, salt: 3.8),
SaizeriyaMenu(category: .hamburgSteak, name: "ハンバーグステーキ", price: 399, kcal: 514, salt: 2.3),
SaizeriyaMenu(category: .hamburgSteak, name: "野菜ソースのハンバーグ", price: 499, kcal: 585, salt: 2.6),
SaizeriyaMenu(category: .hamburgSteak, name: "デミグラスソースのハンバーグ", price: 499, kcal: 628, salt: 3.6),
SaizeriyaMenu(category: .hamburgSteak, name: "イタリアンハンバーグ", price: 499, kcal: 633, salt: 2.5),
SaizeriyaMenu(category: .hamburgSteak, name: "焼肉とハンバーグの盛合せ", price: 599, kcal: 709, salt: 3.4),
SaizeriyaMenu(category: .hamburgSteak, name: "若鶏のグリル", price: 499, kcal: 541, salt: 2.1),
SaizeriyaMenu(category: .hamburgSteak, name: "柔らかチキンのチーズ焼き", price: 499, kcal: 588, salt: 2.0),
SaizeriyaMenu(category: .hamburgSteak, name: "パンチェッタと若鶏のグリル", price: 599, kcal: 663, salt: 2.5),
SaizeriyaMenu(category: .hamburgSteak, name: "ライス", price: 169, kcal: 303, salt: 0.0),
SaizeriyaMenu(category: .hamburgSteak, name: "ラージライス", price: 219, kcal: 454, salt: 0.0),
SaizeriyaMenu(category: .hamburgSteak, name: "スモールライス", price: 119, kcal: 151, salt: 0.0)
]
let dessert = [
SaizeriyaMenu(category: .dessert, name: "カプチーノ", price: 199, kcal: 114, salt: 0.1),
SaizeriyaMenu(category: .dessert, name: "プリンとカプチーノの盛合せ", price: 399, kcal: 330, salt: 0.2),
SaizeriyaMenu(category: .dessert, name: "プリンとティラミスの盛合せ", price: 399, kcal: 347, salt: 0.2),
SaizeriyaMenu(category: .dessert, name: "ティラミス", price: 199, kcal: 131, salt: 0.1),
SaizeriyaMenu(category: .dessert, name: "シナモンフォッカチオ", price: 169, kcal: 246, salt: 0.8),
SaizeriyaMenu(category: .dessert, name: "ミルクアイスのせシナモンフォッカチオ", price: 319, kcal: 346, salt: 0.9),
SaizeriyaMenu(category: .dessert, name: "イタリアンプリン", price: 249, kcal: 216, salt: 0.1),
SaizeriyaMenu(category: .dessert, name: "コーヒーゼリー", price: 299, kcal: 162, salt: 0.1),
SaizeriyaMenu(category: .dessert, name: "トリフアイスクリーム", price: 369, kcal: 164, salt: 0.1),
SaizeriyaMenu(category: .dessert, name: "ミルクジェラート", price: 199, kcal: 199, salt: 0.1),
SaizeriyaMenu(category: .dessert, name: "シチリア産レモンのソルベ", price: 199, kcal: 127, salt: 0.0),
SaizeriyaMenu(category: .dessert, name: "チョコレートケーキ", price: 299, kcal: 166, salt: 0.1)
]
var all: [SaizeriyaMenu] {
return saladSoup + appetizer + fromItalyWine + pizza + pasta + doriaRice + hamburgSteak + dessert
}
}
struct SaizeriyaOrder {
let money: Int
private let database = SaizeriyaMenuDatabase()
func order() -> [SaizeriyaMenu] {
var remain = money
var order = [SaizeriyaMenu]()
while remain > 0 {
guard let menu = randomMenu(remain: remain) else {
break
}
remain = remain - menu.price
order.append(menu)
}
return order
}
private func randomMenu(remain: Int) -> SaizeriyaMenu? {
let list = database.all.filter({ $0.price < remain })
guard list.count > 0,
let menu = list.randomElement() else {
return nil
}
return menu
}
}
let order = SaizeriyaOrder(money: 1000).order()
let name = order.map({ $0.name })
let price = order.reduce(0, { $0 + $1.price })
let cal = order.reduce(0, { $0 + $1.kcal })
let salt = order.reduce(0, { $0 + $1.salt })
print(name)
print(String(price) + "円")
print(String(cal) + "kcal")
print(String(salt) + "g")
/* 出力例
["アーリオ・オーリオ(Wサイズ)", "ポップコーンシュリンプ", "スモールライス"]
992円
1486kcal
7.8g
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment