rianders commited on
Commit
b55787c
·
0 Parent(s):

Initial commit

Browse files
.gitattributes ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
.gitignore ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
105
+ __pypackages__/
106
+
107
+ # Celery stuff
108
+ celerybeat-schedule
109
+ celerybeat.pid
110
+
111
+ # SageMath parsed files
112
+ *.sage.py
113
+
114
+ # Environments
115
+ .env
116
+ .venv
117
+ env/
118
+ venv/
119
+ ENV/
120
+ env.bak/
121
+ venv.bak/
122
+
123
+ # Spyder project settings
124
+ .spyderproject
125
+ .spyproject
126
+
127
+ # Rope project settings
128
+ .ropeproject
129
+
130
+ # mkdocs documentation
131
+ /site
132
+
133
+ # mypy
134
+ .mypy_cache/
135
+ .dmypy.json
136
+ dmypy.json
137
+
138
+ # Pyre type checker
139
+ .pyre/
140
+
141
+ # pytype static type analyzer
142
+ .pytype/
143
+
144
+ # Cython debug symbols
145
+ cython_debug/
146
+
147
+ # PyCharm
148
+ # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
151
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
152
+ #.idea/
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # bigideaviewer
2
+
bigideaviewer/__init__.py ADDED
File without changes
bigideaviewer/app.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+
5
+ # Generate Fibonacci sequence up to a maximum value
6
+ def generate_fibonacci_sequence(max_value):
7
+ sequence = [1, 1]
8
+ while sequence[-1] <= max_value:
9
+ next_value = sequence[-1] + sequence[-2]
10
+ sequence.append(next_value)
11
+ return sequence[:-1]
12
+
13
+ # Function to plot the graph
14
+ def plot_graph(data, title):
15
+ fig, ax = plt.subplots()
16
+ for _, row in data.iterrows():
17
+ ax.scatter(x=row['Complexity'], y=row['User Value'], alpha=0.5)
18
+ ax.set_xlabel("Complexity")
19
+ ax.set_ylabel("User Value")
20
+ ax.set_title(title)
21
+ ax.grid(True)
22
+ return fig
23
+
24
+ # Function to reset the game
25
+ def reset_game():
26
+ st.session_state['current_turn'] = 1
27
+ st.session_state['current_round'] = 1
28
+ st.session_state['players'] = {}
29
+ st.session_state['total_funding'] = {}
30
+ st.session_state['voting_phase'] = False
31
+
32
+ # Function to handle the next turn
33
+ def handle_next_turn(number_of_players):
34
+ if st.session_state['current_round'] < number_of_players:
35
+ st.session_state['current_round'] += 1
36
+ else:
37
+ if not st.session_state['voting_phase']:
38
+ st.session_state['voting_phase'] = True
39
+ else:
40
+ st.session_state['current_round'] = 1
41
+ st.session_state['current_turn'] += 1
42
+
43
+ # Function to handle displaying game results
44
+ def display_results(number_of_players):
45
+ st.header("Game Results")
46
+ combined_data = []
47
+ for player in range(1, number_of_players + 1):
48
+ idea_key = f'big_idea_{player}'
49
+ idea_ratings = st.session_state['players'].get(idea_key, {})
50
+ if idea_ratings:
51
+ df = pd.DataFrame(idea_ratings)
52
+ total_funding = df['votes'].sum()
53
+ st.session_state['total_funding'][player] = total_funding
54
+ st.subheader(f"Player {player}'s Idea: {st.session_state['players'][idea_key].get('idea_name', '')}")
55
+ st.write(f"Total Funding Points: {total_funding}")
56
+ combined_data.extend(df.to_dict('records'))
57
+
58
+ # Plotting the combined graph
59
+ if combined_data:
60
+ combined_df = pd.DataFrame(combined_data)
61
+ fig = plot_graph(combined_df, "Complexity vs User Value")
62
+ st.pyplot(fig)
63
+
64
+ # Main game function
65
+ def main():
66
+ # Initialize session state variables if they don't exist
67
+ if 'current_turn' not in st.session_state:
68
+ reset_game()
69
+
70
+ # App title
71
+ st.title("Big Idea Evaluation Game")
72
+
73
+ # Game Setup
74
+ number_of_players = st.number_input("Enter the number of players", min_value=2, max_value=10, value=4)
75
+ fibonacci_sequence = generate_fibonacci_sequence(55)
76
+
77
+ # Display current turn and round
78
+ st.header(f"Turn {st.session_state['current_turn']}, Round {st.session_state['current_round']}")
79
+
80
+ # Voting Phase
81
+ if st.session_state['voting_phase']:
82
+ st.header("Voting Phase")
83
+ st.write("Pass the phone around, and other players can now evaluate the idea and record their values and reactions.")
84
+
85
+ # Create a dictionary to store votes for each invention
86
+ invention_votes = {key: 0 for key in st.session_state['players'].keys()}
87
+
88
+ # Allow each player to vote
89
+ for player in range(1, number_of_players + 1):
90
+ if player != st.session_state['current_turn']:
91
+ invention_key = f'big_idea_{player}'
92
+
93
+ # Check if the key exists and create it if it doesn't
94
+ if invention_key not in st.session_state['players']:
95
+ st.session_state['players'][invention_key] = {}
96
+
97
+ st.write(f"Player {player}, please distribute your Fibonacci cards among the inventions:")
98
+ st.session_state['players'][invention_key]['votes'] = st.slider(f"Votes for Player {player}'s Idea", 0, 55, step=1, key=f'votes_{player}')
99
+
100
+ # Player's Turn and Idea Pitch
101
+ presenting_player = st.session_state['current_turn']
102
+ idea_input_key = f'big_idea_{presenting_player}'
103
+
104
+ # Store and display ideas for each player
105
+ if idea_input_key not in st.session_state['players']:
106
+ st.session_state['players'][idea_input_key] = {}
107
+
108
+ st.subheader(f"Player {presenting_player}'s Turn, Round {st.session_state['current_round']}")
109
+
110
+ # Idea submission with a separate button
111
+ idea_name = st.text_input(f"Enter your Big Idea Name:")
112
+
113
+ # Check if it's the current player's turn to submit an idea
114
+ if st.session_state['current_turn'] == presenting_player:
115
+ submit_idea_button = st.button("Submit Idea")
116
+ else:
117
+ submit_idea_button = False
118
+
119
+ # Evaluate Ideas (Non-pitching players only)
120
+ if st.session_state['current_turn'] != presenting_player:
121
+ st.subheader(f"Evaluate Player {presenting_player}'s Idea, Round {st.session_state['current_round']}:")
122
+ user_value_key = f'user_value_{presenting_player}'
123
+ complexity_key = f'complexity_{presenting_player}'
124
+ funding_key = f'funding_{presenting_player}'
125
+
126
+ if idea_input_key not in st.session_state['players']:
127
+ st.session_state['players'][idea_input_key] = {}
128
+
129
+ if user_value_key not in st.session_state['players'][idea_input_key]:
130
+ user_value_rating = st.select_slider(f"Player {presenting_player} - User Value", options=fibonacci_sequence, key=user_value_key)
131
+ complexity_rating = st.select_slider(f"Player {presenting_player} - Complexity", options=fibonacci_sequence, key=complexity_key)
132
+
133
+ # Store the ratings in session state
134
+ st.session_state['players'][idea_input_key][user_value_key] = user_value_rating
135
+ st.session_state['players'][idea_input_key][complexity_key] = complexity_rating
136
+
137
+ # Check if the idea submission button is clicked
138
+ if submit_idea_button:
139
+ st.session_state['players'][idea_input_key]['idea_name'] = idea_name
140
+ handle_next_turn(number_of_players)
141
+
142
+ # Show Results and Plot Graph
143
+ if st.button("Show Results"):
144
+ display_results(number_of_players)
145
+
146
+ # Reset Game Button (Optional)
147
+ if st.button("Reset Game"):
148
+ reset_game()
149
+ st.rerun()
150
+
151
+ if __name__ == '__main__':
152
+ main()
bigideaviewer/app2.py ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+ import random
5
+
6
+ # Define game phases
7
+ PHASE_DRAW_CARDS = 0
8
+ PHASE_PITCH_IDEAS = 1
9
+ PHASE_VOTE = 2
10
+ PHASE_RESULTS = 3
11
+
12
+ # Generate Fibonacci sequence up to a maximum value
13
+ def generate_fibonacci_sequence(max_value):
14
+ sequence = [1, 1]
15
+ while sequence[-1] <= max_value:
16
+ next_value = sequence[-1] + sequence[-2]
17
+ sequence.append(next_value)
18
+ return sequence[:-1]
19
+
20
+ # Function to plot the graph
21
+ def plot_graph(data, title):
22
+ fig, ax = plt.subplots()
23
+ for _, row in data.iterrows():
24
+ ax.scatter(x=row['Complexity'], y=row['User Value'], alpha=0.5)
25
+ ax.set_xlabel("Complexity")
26
+ ax.set_ylabel("User Value")
27
+ ax.set_title(title)
28
+ ax.grid(True)
29
+ return fig
30
+
31
+ # Initialize game state variables
32
+ def init_game_state():
33
+ st.session_state['current_turn'] = 1
34
+ st.session_state['current_round'] = 1
35
+ st.session_state['current_player'] = 1
36
+ st.session_state['current_phase'] = 'draw'
37
+ st.session_state['players'] = {}
38
+ st.session_state['total_funding'] = {}
39
+ st.session_state['voting_phase'] = False
40
+
41
+ # Simulate drawing of Item and Descriptor cards
42
+ def draw_cards(n_items, n_descriptors, players):
43
+ items = ["Item1", "Item2", "Item3"] # Replace with actual items
44
+ descriptors = ["Descriptor1", "Descriptor2", "Descriptor3"] # Replace with actual descriptors
45
+
46
+ for player in players:
47
+ drawn_items = random.sample(items, n_items)
48
+ drawn_descriptors = random.sample(descriptors, n_descriptors)
49
+ players[player]['cards'] = {'items': drawn_items, 'descriptors': drawn_descriptors}
50
+
51
+ def display_sidebar(players):
52
+ st.sidebar.title("Players' Cards")
53
+ for player, data in players.items():
54
+ st.sidebar.subheader(f"{player}'s Cards")
55
+
56
+ # Check if the player has drawn cards
57
+ if 'cards' in data:
58
+ for card_type, cards in data['cards'].items():
59
+ st.sidebar.write(f"{card_type.capitalize()}: {', '.join(cards)}")
60
+ else:
61
+ st.sidebar.write("No cards drawn yet.")
62
+
63
+ def pitch_idea(player):
64
+ st.subheader(f"Player {player}'s Turn to Pitch")
65
+ if player not in st.session_state['players']:
66
+ st.session_state['players'][player] = {}
67
+
68
+ idea_name = st.text_input("Enter your Big Idea Name:", key=f"{player}_idea_name")
69
+ #idea_description = st.text_area("Describe your Big Idea:", key=f"{player}_idea_desc")
70
+
71
+ # if st.button("Submit Idea", key=f"{player}_submit"):
72
+ # st.session_state['players'][player]['idea_name'] = idea_name
73
+ # #st.session_state['players'][player]['idea_desc'] = idea_description
74
+ # st.session_state['current_turn'] += 1
75
+ # if st.session_state['current_turn'] > len(st.session_state['players']):
76
+ # st.session_state['current_turn'] = 1
77
+ # st.session_state['current_phase'] = 'vote'
78
+ print("end of pitch_idea")
79
+
80
+
81
+ def vote_on_ideas(number_of_players):
82
+ print("Start of vote_on_ideas")
83
+ st.header("Voting Phase")
84
+ fibonacci_sequence = generate_fibonacci_sequence(55)
85
+
86
+ for player, data in st.session_state['players'].items():
87
+ if player != f"Player {st.session_state['current_turn']}":
88
+ st.subheader(f"{data.get('idea_name', 'No Idea Submitted')}")
89
+ st.write(data.get('idea_desc', ''))
90
+ vote = st.select_slider(f"Votes for {player}", options=fibonacci_sequence, key=f"{player}_votes")
91
+ st.session_state['players'][player]['votes'] = vote
92
+
93
+ if st.button("Finish Voting"):
94
+ st.session_state['current_phase'] = 'results'
95
+
96
+
97
+ def calculate_results(number_of_players):
98
+ st.header("Game Results")
99
+ results = {}
100
+ for player, data in st.session_state['players'].items():
101
+ results[player] = data.get('votes', 0)
102
+
103
+ sorted_results = sorted(results.items(), key=lambda x: x[1], reverse=True)
104
+ for player, votes in sorted_results:
105
+ st.write(f"{player}: {votes} votes")
106
+
107
+ winner = sorted_results[0][0]
108
+ st.success(f"The winner is {winner} with {sorted_results[0][1]} votes!")
109
+
110
+ if st.button("Play Again"):
111
+ reset_game()
112
+
113
+
114
+ # Reset the game
115
+ def reset_game():
116
+ st.session_state['current_turn'] = 1
117
+ st.session_state['current_round'] = 1
118
+ st.session_state['current_phase'] = 'draw'
119
+ st.session_state['players'] = {}
120
+ st.session_state['total_funding'] = {}
121
+ st.session_state['voting_phase'] = False
122
+
123
+ # Main game function
124
+ def main():
125
+ # Initialize game state
126
+ init_game_state()
127
+
128
+ # Setup and instructions
129
+ st.title("Big Idea Evaluation Game")
130
+ number_of_players = st.number_input("Enter the number of players", min_value=2, max_value=10, value=4)
131
+
132
+ # Initialize game phase
133
+ current_phase = PHASE_DRAW_CARDS
134
+
135
+ while current_phase < PHASE_RESULTS: # You can define your game-ending condition
136
+ if current_phase == PHASE_DRAW_CARDS:
137
+ draw_cards(n_items=3, n_descriptors=3, players=st.session_state['players'])
138
+ current_phase = PHASE_PITCH_IDEAS
139
+
140
+ elif current_phase == PHASE_PITCH_IDEAS:
141
+ current_player = f"Player {st.session_state['current_turn']}"
142
+ pitch_idea(current_player)
143
+ current_phase = PHASE_VOTE
144
+
145
+ elif current_phase == PHASE_VOTE:
146
+ vote_on_ideas(number_of_players)
147
+ current_phase = PHASE_RESULTS
148
+
149
+ elif current_phase == PHASE_RESULTS:
150
+ calculate_results(number_of_players)
151
+ current_phase = PHASE_DRAW_CARDS # Go back to the beginning for the next round
152
+
153
+
154
+ # Reset game button
155
+ if st.button("Reset Game"):
156
+ reset_game()
157
+
158
+ if __name__ == '__main__':
159
+ main()
bigideaviewer/app3.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+ import random
5
+
6
+ # Sample player names
7
+ sample_player_names = ["Alice", "Bob", "Charlie", "Diana", "Ethan", "Fiona", "George", "Hannah", "Ivan", "Julia", "Aisha", "Carlos", "Mei", "Raj", "Lerato", "Dmitry", "Isabella", "Yuto", "Chloe", "Tariq"]
8
+
9
+
10
+ # Generate Fibonacci sequence up to a maximum value
11
+ def generate_fibonacci_sequence(max_value):
12
+ sequence = [0, 1]
13
+ while sequence[-1] + sequence[-2] <= max_value:
14
+ sequence.append(sequence[-1] + sequence[-2])
15
+ return sequence
16
+
17
+ def plot_graph(data, title):
18
+ fig, ax = plt.subplots()
19
+
20
+ # Plotting data points
21
+ for _, row in data.iterrows():
22
+ ax.scatter(x=row['User Value'], y=row['Complexity'], alpha=0.5, label=row['Player']) # Swap X and Y
23
+
24
+ # Setting axis limits
25
+ ax.set_xlim(0, 55)
26
+ ax.set_ylim(0, 55)
27
+
28
+ # Drawing lines for quadrants
29
+ ax.axhline(y=27.5, color='gray', linestyle='--')
30
+ ax.axvline(x=27.5, color='gray', linestyle='--')
31
+
32
+ # Axis labels and title
33
+ ax.set_xlabel("User Value") # Swapped label
34
+ ax.set_ylabel("Complexity") # Swapped label
35
+ ax.set_title(title)
36
+
37
+ # Adding a grid and legend
38
+ ax.legend()
39
+ ax.grid(True)
40
+
41
+ return fig
42
+
43
+
44
+
45
+
46
+
47
+ # Function to display pitch and review for a player
48
+ def display_pitch_and_review(pitcher, player_names, max_fibonacci_value, fibonacci_numbers):
49
+ with st.container():
50
+ # Project Name
51
+ project_key = f'project_{pitcher}'
52
+ if project_key not in st.session_state:
53
+ st.session_state[project_key] = ''
54
+ project_name = st.text_input(f"Project Name by {pitcher}", st.session_state[project_key])
55
+
56
+ # Other players review the pitch
57
+ for reviewer in player_names:
58
+ if reviewer != pitcher:
59
+ st.write(f"{reviewer}'s Review")
60
+
61
+ # Define keys for each input
62
+ complexity_key = f'complexity_{pitcher}_{reviewer}'
63
+ user_value_key = f'user_value_{pitcher}_{reviewer}'
64
+ funding_key = f'funding_{pitcher}_{reviewer}'
65
+
66
+ # Initialize session state variables with randomized default values if not exist
67
+ if complexity_key not in st.session_state:
68
+ st.session_state[complexity_key] = random.choice(fibonacci_numbers)
69
+ if user_value_key not in st.session_state:
70
+ st.session_state[user_value_key] = random.choice(fibonacci_numbers)
71
+ if funding_key not in st.session_state:
72
+ st.session_state[funding_key] = random.choice(fibonacci_numbers)
73
+
74
+ # Sliders with session state
75
+ complexity = st.slider(f"Complexity for {project_name}", 0, max_fibonacci_value, st.session_state[complexity_key], key=complexity_key)
76
+ user_value = st.slider(f"User Value for {project_name}", 0, max_fibonacci_value, st.session_state[user_value_key], key=user_value_key)
77
+ funding_points = st.slider(f"Funding Points for {project_name}", 0, max_fibonacci_value, st.session_state[funding_key], key=funding_key)
78
+
79
+ # Save review data
80
+ new_row = {
81
+ "Player": reviewer,
82
+ "Project": project_name,
83
+ "Complexity": complexity,
84
+ "User Value": user_value,
85
+ "Funding Points": funding_points
86
+ }
87
+ st.session_state['game_data'] = pd.concat([st.session_state['game_data'], pd.DataFrame([new_row])], ignore_index=True)
88
+
89
+ # Function to update game data
90
+ def update_game_data(pitcher, project_name, player_names, max_fibonacci_value):
91
+ for reviewer in player_names:
92
+ if reviewer != pitcher:
93
+ complexity_key = f'complexity_{pitcher}_{reviewer}'
94
+ user_value_key = f'user_value_{pitcher}_{reviewer}'
95
+ funding_key = f'funding_{pitcher}_{reviewer}'
96
+
97
+ new_row = {
98
+ "Player": reviewer,
99
+ "Project": project_name,
100
+ "Complexity": st.session_state[complexity_key],
101
+ "User Value": st.session_state[user_value_key],
102
+ "Funding Points": st.session_state[funding_key]
103
+ }
104
+ st.session_state['game_data'] = pd.concat([st.session_state['game_data'], pd.DataFrame([new_row])], ignore_index=True)
105
+
106
+
107
+ # Initialize Streamlit app
108
+ st.title("Pitch Review Game")
109
+
110
+ # Number of players and their names using the sidebar
111
+ number_of_players = st.sidebar.number_input("Enter number of players", 2, 10, 4)
112
+ player_names = []
113
+ for i in range(number_of_players):
114
+ default_name = random.choice(sample_player_names) # Get a random name
115
+ name = st.sidebar.text_input(f"Name of player {i+1}", value=default_name, key=f'player_{i}')
116
+ player_names.append(name)
117
+
118
+ # Initialize game data if not present
119
+ if 'game_data' not in st.session_state:
120
+ st.session_state['game_data'] = pd.DataFrame(columns=["Player", "Project", "Complexity", "User Value", "Funding Points"])
121
+
122
+ # Fibonacci numbers for scoring
123
+ fibonacci_numbers = generate_fibonacci_sequence(55)
124
+ max_fibonacci_value = max(fibonacci_numbers)
125
+
126
+ # Display pitch and review based on the selected player
127
+ if 'selected_pitcher' in st.session_state and st.session_state['selected_pitcher']:
128
+ display_pitch_and_review(st.session_state['selected_pitcher'], player_names, max_fibonacci_value)
129
+ if st.button("Save Reviews"):
130
+ update_game_data(st.session_state['selected_pitcher'], st.session_state[f'project_{st.session_state["selected_pitcher"]}'], player_names, max_fibonacci_value)
131
+ st.session_state['selected_pitcher'] = None # Reset after saving
132
+
133
+ # Sidebar buttons for each player's pitch
134
+ for pitcher in player_names:
135
+ if st.sidebar.button(f"{pitcher}'s Pitch", key=f'pitch_{pitcher}'):
136
+ st.session_state['selected_pitcher'] = pitcher
137
+
138
+ # Show Results and Restart Game buttons in the sidebar
139
+ if st.sidebar.button("Show Results"):
140
+ st.write(st.session_state['game_data'])
141
+ fig = plot_graph(st.session_state['game_data'], "Project Complexity vs User Value")
142
+ st.pyplot(fig)
143
+
144
+ if st.sidebar.button("Restart Game"):
145
+ st.session_state['game_data'] = pd.DataFrame(columns=["Player", "Project", "Complexity", "User Value", "Funding Points"])
146
+ # Optionally clear all session state
147
+ for key in list(st.session_state.keys()):
148
+ del st.session_state[key]
149
+
150
+ # Ensure all players are named before proceeding
151
+ if not all(player_names):
152
+ st.sidebar.warning("Please enter names for all players.")
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "bigideaviewer"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["ricklon <rianders@docs.rutgers.edu>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = ">=3.9,<3.9.7 || >3.9.7,<4.0"
10
+ streamlit = "^1.29.0"
11
+ pandas = "^2.1.4"
12
+ matplotlib = "^3.8.2"
13
+
14
+
15
+ [build-system]
16
+ requires = ["poetry-core"]
17
+ build-backend = "poetry.core.masonry.api"
tests/__init__.py ADDED
File without changes