|
38 | 38 |
|
39 | 39 |
|
40 | 40 |
|
41 | | - local view = Window.open(template_config.filetype, App["build-default-window-dispatch-options"](app), {width = template_config.view.width, height = template_config.view.height, ["window-position"] = app_config["window-position"], ["minimise-position"] = app_config["minimise-position"]}) |
| 41 | + local view = Window.open(template_config.filetype, App["build-default-window-dispatch-options"](app), {width = template_config.view.width, height = template_config.view.height, ["window-border"] = app_config["window-border"], ["window-position"] = app_config["window-position"], ["minimise-position"] = app_config["minimise-position"]}) |
| 42 | + |
42 | 43 |
|
43 | 44 |
|
44 | 45 |
|
|
54 | 55 | local function _8_() return app["queue-event"](app, "app", "deal") end vim.defer_fn(_8_, 300) return app:render() end |
55 | 56 |
|
56 | 57 |
|
57 | | - M["setup-new-game"] = function(app, game_config, _3fseed) _G.assert((nil ~= game_config), "Missing argument game-config on fnl/playtime/app/patience/init.fnl:57") _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:57") app["new-game"](app, app.Impl.LogicImpl.build, game_config, _3fseed) app["build-components"](app) app["switch-state"](app, app.Impl.StateImpl.Default) |
| 58 | + M["setup-new-game"] = function(app, game_config, _3fseed) _G.assert((nil ~= game_config), "Missing argument game-config on fnl/playtime/app/patience/init.fnl:58") _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:58") app["new-game"](app, app.Impl.LogicImpl.build, game_config, _3fseed) app["build-components"](app) app["switch-state"](app, app.Impl.StateImpl.Default) |
58 | 59 |
|
59 | 60 |
|
60 | 61 |
|
61 | 62 | return app end |
62 | 63 |
|
63 | | - M["build-components"] = function(app) _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:63") |
64 | | - local card_card_components do local tbl_16_auto = {} for location, card in app.Impl.LogicImpl["iter-cards"](app.game) do local k_17_auto, v_18_auto = nil, nil |
| 64 | + M["build-components"] = function(app) _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:64") |
| 65 | + local card_card_components do local tbl_16_ = {} for location, card in app.Impl.LogicImpl["iter-cards"](app.game) do local k_17_, v_18_ = nil, nil |
65 | 66 | do local comp local function _9_(...) return app["location->position"](app, ...) end comp = CardComponents.card(_9_, location, card, app["card-style"]) |
66 | 67 |
|
67 | 68 |
|
68 | 69 |
|
69 | | - k_17_auto, v_18_auto = card.id, comp end if ((k_17_auto ~= nil) and (v_18_auto ~= nil)) then tbl_16_auto[k_17_auto] = v_18_auto else end end card_card_components = tbl_16_auto end |
| 70 | + k_17_, v_18_ = card.id, comp end if ((k_17_ ~= nil) and (v_18_ ~= nil)) then tbl_16_[k_17_] = v_18_ else end end card_card_components = tbl_16_ end |
70 | 71 | local menubar = CommonComponents.menubar({{app.name, {"file"}, {{"", nil}, {"New Deal", {"new-deal"}}, {"Repeat Deal", {"repeat-deal"}}, {"", nil}, {"Undo", {"undo"}}, {"", nil}, {"Save current game", {"save"}}, {"Load last save", {"load"}}, {"", nil}, {"Quit", {"quit"}}, {"", nil}, {string.format("Seed: %s", app.seed), nil}}}}, {width = app.view.width, z = app["z-index-for-layer"](app, "menubar")}) local win_count |
71 | 72 |
|
72 | 73 |
|
|
88 | 89 |
|
89 | 90 | local empty_fields = app.Template["empty-fields"] local empty_fields0 |
90 | 91 | do local base = {} for _, _12_ in ipairs(empty_fields) do local field = _12_[1] local count = _12_[2] |
91 | | - local tbl_19_auto = base for i = 1, count do local val_20_auto |
| 92 | + local tbl_19_ = base for i = 1, count do local val_20_ |
92 | 93 | local function _13_(location) |
93 | | - return table.set(app["location->position"](app, location), "z", app["z-index-for-layer"](app, "base")) end val_20_auto = CardComponents.slot(_13_, {field, i, 0}, app["card-style"]) table.insert(tbl_19_auto, val_20_auto) end base = tbl_19_auto end empty_fields0 = base end |
| 94 | + return table.set(app["location->position"](app, location), "z", app["z-index-for-layer"](app, "base")) end val_20_ = CardComponents.slot(_13_, {field, i, 0}, app["card-style"]) table.insert(tbl_19_, val_20_) end base = tbl_19_ end empty_fields0 = base end |
94 | 95 |
|
95 | 96 |
|
96 | 97 |
|
|
104 | 105 | app.components.cards = table.values(card_card_components) |
105 | 106 | return app end |
106 | 107 |
|
107 | | - M["standard-patience-components"] = function(app) _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:107") |
108 | | - local tbl_21_auto = {} local i_22_auto = 0 for _, key in ipairs({"game-report", "win-count", "menubar", "cheating"}) do |
109 | | - local val_23_auto = app.components[key] if (nil ~= val_23_auto) then i_22_auto = (i_22_auto + 1) tbl_21_auto[i_22_auto] = val_23_auto else end end return tbl_21_auto end |
| 108 | + M["standard-patience-components"] = function(app) _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:108") |
| 109 | + local tbl_21_ = {} local i_22_ = 0 for _, key in ipairs({"game-report", "win-count", "menubar", "cheating"}) do |
| 110 | + local val_23_ = app.components[key] if (nil ~= val_23_) then i_22_ = (i_22_ + 1) tbl_21_[i_22_] = val_23_ else end end return tbl_21_ end |
110 | 111 |
|
111 | | - M.save = function(app, filename) _G.assert((nil ~= filename), "Missing argument filename on fnl/playtime/app/patience/init.fnl:111") _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:111") |
| 112 | + M.save = function(app, filename) _G.assert((nil ~= filename), "Missing argument filename on fnl/playtime/app/patience/init.fnl:112") _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:112") |
112 | 113 |
|
113 | 114 |
|
114 | 115 |
|
115 | 116 |
|
116 | 117 |
|
117 | | - local _15_ do local tbl_21_auto = {} local i_22_auto = 0 for _, _16_ in ipairs(app["game-history"]) do local _state = _16_[1] local action = _16_[2] |
118 | | - local val_23_auto = action if (nil ~= val_23_auto) then i_22_auto = (i_22_auto + 1) tbl_21_auto[i_22_auto] = val_23_auto else end end _15_ = tbl_21_auto end return App.save(app, filename, {version = 1, ["app-id"] = app["app-id"], seed = app.seed, config = app["game-config"], latest = app.game, replay = _15_}) end |
| 118 | + local _15_ do local tbl_21_ = {} local i_22_ = 0 for _, _16_ in ipairs(app["game-history"]) do local _state = _16_[1] local action = _16_[2] |
| 119 | + local val_23_ = action if (nil ~= val_23_) then i_22_ = (i_22_ + 1) tbl_21_[i_22_] = val_23_ else end end _15_ = tbl_21_ end return App.save(app, filename, {version = 1, ["app-id"] = app["app-id"], seed = app.seed, config = app["game-config"], latest = app.game, replay = _15_}) end |
119 | 120 |
|
120 | | - M.load = function(app, filename) _G.assert((nil ~= filename), "Missing argument filename on fnl/playtime/app/patience/init.fnl:120") _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:120") |
| 121 | + M.load = function(app, filename) _G.assert((nil ~= filename), "Missing argument filename on fnl/playtime/app/patience/init.fnl:121") _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:121") |
121 | 122 | local function _18_(...) local _19_ = ... if (nil ~= _19_) then local data = _19_ |
122 | 123 |
|
123 | | - local config = data["config"] local seed = data["seed"] local latest = data["latest"] local replay = data["replay"] app["setup-new-game"](app, config, seed) return app["queue-event"](app, "app", "replay", {replay = replay, verify = latest}) else local __85_auto = _19_ return ... end end return _18_(App.load(app, filename)) end |
| 124 | + local config = data["config"] local seed = data["seed"] local latest = data["latest"] local replay = data["replay"] app["setup-new-game"](app, config, seed) return app["queue-event"](app, "app", "replay", {replay = replay, verify = latest}) else local __44_ = _19_ return ... end end return _18_(App.load(app, filename)) end |
124 | 125 |
|
125 | 126 |
|
126 | 127 |
|
127 | | - M["update-statistics"] = function(app) _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:127") |
| 128 | + M["update-statistics"] = function(app) _G.assert((nil ~= app), "Missing argument app on fnl/playtime/app/patience/init.fnl:128") |
128 | 129 | local function update(d) |
129 | 130 | local data = table.merge({version = 1, wins = 0, games = {}}, d) |
130 | 131 | data.wins = (data.wins + 1) |
|
0 commit comments