chore: import upstream snapshot with attribution
CI / compile_and_lint (push) Failing after 0s
CI / docker_build (linux/amd64, -linux-amd64-duckdb, duckdb) (push) Failing after 0s
CI / docker_build (linux/arm64, -linux-arm64, minimal) (push) Failing after 2s
CI / docker_build (linux/arm64, -linux-arm64-duckdb, duckdb) (push) Failing after 1s
CI / docker_build (linux/amd64, minimal) (push) Failing after 1s
CI / test (, sqlite, sqlite::memory:) (push) Has been skipped
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (oracle, oracle, Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!) (push) Has been skipped
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been skipped
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / playwright (push) Has been skipped
CI / docker_build (linux/arm/v7, -linux-arm-v7, minimal) (push) Failing after 0s
CI / hurl_examples (push) Failing after 8s
deploy website / deploy_official_site (push) Failing after 1s
CI / hurl (${{ matrix.example }}) (push) Has been skipped
CI / docker_push (duckdb) (push) Has been cancelled
CI / docker_push (minimal) (push) Has been cancelled
CI / windows_test (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:31:57 +08:00
commit d718c5a372
986 changed files with 74597 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
sqlpage.db
+4
View File
@@ -0,0 +1,4 @@
FROM lovasoa/sqlpage:main
COPY ./sqlpage /etc/sqlpage
COPY . /var/www
@@ -0,0 +1,5 @@
INSERT INTO games(id)
VALUES(random())
RETURNING
'redirect' as component,
CONCAT('game.sql?id=', id) as link;
+38
View File
@@ -0,0 +1,38 @@
# Corporate Conundrum: Decisions in Disguise
This is the web version of a board game, coded entirely in SQL.
## Pitch
Unleash your inner executive as you step into the shoes of top-level employees in a high-stakes corporate meeting. But beware, among your trusted colleagues lurks a cunning infiltrator sent by a rival company to sabotage your decision-making process. Will you be able to outsmart the saboteur and make the right choices to lead your company to success?
## Rules
**Objective**: As a team of genuine employees, your goal is to make accurate decisions based on challenging questions. The infiltrator's objective is to sway you toward incorrect answers.
**Gameplay**: Each turn, a question will be presented to the group. One player, secretly assigned as the infiltrator, will receive a specific wrong answer. They must cunningly lead others astray, while you must collaborate and deduce the correct answer.
**Discussion Phase**: Engage in lively debates and exchange ideas to uncover the truth. Analyze arguments, question motives, and use your critical thinking skills to navigate the murky waters of corporate deception.
**Hidden Votes**: After the discussion phase, all players simultaneously submit their individual answers privately, without revealing them to others.
**Scoring System**: Points are awarded based on the proximity of each player's answer to the true answer.
- If a player's answer is closer to the true answer than to the wrong answer provided by the saboteur, they earn one point.
- Conversely, if a player's answer is closer to the wrong answer, they inadvertently contribute one point to the saboteur's score.
**Continuing Gameplay**: The game progresses with new questions and role assignments, allowing each player to take turns as the infiltrator. The player with the highest score at the end of the predetermined number of rounds wins the game.
## Web app usage
Create a new game by clicking the "New Game" button. You will be prompted to add new players to the game by adding their names. Share the game URL with other players so they can join the game.
Role Assignment: The web app will randomly assign roles to players, designating one as the infiltrator.
Question and Wrong Answer: The web app will display the question to all players, and only the infiltrator will see an additional mention with the assigned wrong answer.
Discussion and Decision-making: You need to be in the same room as the other players, and discuss the question and the wrong answer. The infiltrator will try to convince you to choose the wrong answer.
Answer Submission: Once the discussion phase ends, enter your individual answer into the web app. The web app will track points earned based on the accuracy of each player's answer.
Get ready to immerse yourself in the thrilling world of corporate espionage, where every decision is shrouded in uncertainty. Can you decipher the truth from deceit and lead your company to victory? Prepare for "Corporate Conundrum: Decisions in Disguise" and prove your mettle as a strategic mastermind!
@@ -0,0 +1,7 @@
services:
web:
build: .
ports:
- "8080:8080"
environment:
DATABASE_URL: sqlite:///tmp/corporate-conundrum.db?mode=rwc
Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

@@ -0,0 +1,44 @@
select * FROM sqlpage_shell;
-- Game over, questions breakdown
select 'card' as component,
2 AS columns,
'The game is over' as title,
'Breaking down the results per question' as description;
SELECT question_text as title,
'The true answer was ' || true_answer || '. ' || impostor || ' tried to make everyone think it was ' || wrong_answer || '. ' || (
select group_concat(
player_name || ' voted ' || answer_value || CASE
WHEN abs(answer_value - true_answer) < abs(answer_value - wrong_answer)
THEN ' and earned a point'
WHEN player_name = impostor
THEN ' and did not earn a point'
ELSE ' and gave a point to ' || impostor
END,
', '
)
from answers
where answers.game_id = $game_id::integer
and answers.question_id = questions.id
) || '.' as description,
explanation as footer
FROM game_questions
JOIN questions ON game_questions.question_id = questions.id
WHERE game_id = $game_id::integer
ORDER BY game_order;
-- Point count
SELECT 'chart' as component,
'Scores' as title,
'bar' as type;
SELECT name as label,
(
select sum(
(players.name = player_name AND NOT impostor_won)
OR (players.name != player_name AND players.name = impostor AND impostor_won)
)
FROM game_results WHERE game_id = $game_id
) as value
FROM players
WHERE game_id = $game_id::integer
ORDER BY value DESC;
+57
View File
@@ -0,0 +1,57 @@
select * FROM sqlpage_shell;
-- Display the list of players with a link for each one to start playing
INSERT INTO players(name, game_id)
SELECT $Player as name,
CAST($id AS INTEGER) as game_id
WHERE $Player IS NOT NULL;
SELECT 'list' as component,
'Players' as title;
SELECT name as title,
sqlpage.link(
'next-question.sql',
json_object(
'game_id', game_id,
'player', name
)
) as link
FROM players
WHERE game_id = CAST($id AS INTEGER);
---------------------------
-- Player insertion form --
---------------------------
SELECT 'form' as component,
'Add a new player' as title,
'Add to game' as validate;
SELECT 'Player' as name,
'Player name' as placeholder,
TRUE as autofocus;
-- Insert a new question into the game_questions table for each new player
INSERT INTO game_questions(
game_id,
question_id,
wrong_answer,
impostor,
game_order
)
SELECT CAST($id AS INTEGER) as game_id,
questions.id as question_id,
-- When the true answer is small, set the wrong answer to just +/- 1, otherwise -25%/+75%.
-- When it is a date between 1200 and 2100, make it -25 % or +75 % of the distance to today
CAST(CASE
WHEN questions.true_answer < 10 THEN questions.true_answer + 1 - 2 * abs(random() %2) -- wrong answer = true answer +/- 1
WHEN questions.true_answer > 1200
AND questions.true_answer < 2100 THEN 2023 - (2023 - questions.true_answer) * (abs(random() %2) + 0.75) -- wrong answer = true answer -25% or +75% of the distance to today
ELSE questions.true_answer * (abs(random() %2) + 0.75)
END AS INTEGER) as wrong_answer,
-- wrong answer = true answer +/- 50% TODO: better wrong answer generation
$Player as impostor,
random() as game_order
FROM questions
LEFT JOIN game_questions ON questions.id = game_questions.question_id
AND game_questions.game_id = CAST($id AS INTEGER)
WHERE game_questions.question_id IS NULL
AND $Player IS NOT NULL
ORDER BY random()
LIMIT 1;
+22
View File
@@ -0,0 +1,22 @@
select * FROM sqlpage_shell;
SELECT 'hero' as component,
'Welcome to Corporate Conundrum' as title,
'Unleash your inner executive in this thrilling board game of corporate espionage. Make the right choices to lead your company to success!' as description,
'New Game.sql' as link,
'Start a New Game' as link_text;
SELECT 'Lively discussions' as title,
'Each turn, a question will be presented to the group. One player will be assigned as the infiltrator and receive a specific wrong answer. Engage in lively real-life debates and exchange ideas to uncover the truth and make accurate decisions.' as description,
'help-hexagon' as icon,
'blue' as color;
SELECT 'Hidden Votes' as title,
'After the discussion phase, all players submit their individual answers privately. Points are awarded based on their proximity to the true answer.' as description,
'file' as icon,
'green' as color;
SELECT 'Role Assignment' as title,
'The web app randomly assigns roles to players, designating one as the infiltrator. The infiltrator''s objective is to sway others toward incorrect answers, while the team tries to collaborate and deduce the correct answer.' as description,
'spy' as icon,
'red' as color;
SELECT 'Continuing Gameplay' as title,
'The game progresses with new questions and role assignments, allowing each player to take turns as the infiltrator. The player with the highest score at the end of the predetermined number of rounds wins the game.' as description,
'player-play' as icon,
'purple' as color;
@@ -0,0 +1,32 @@
-- We need to redirect the user to the next question in the game if there is one, or to the game over page if there are no more questions.
with next_question as (
SELECT
'question.sql' as page,
json_object(
'game_id', $game_id,
'question_id', game_questions.question_id,
'player', $player
) as params
FROM game_questions
WHERE game_id = $game_id::integer
AND NOT EXISTS (
-- This will filter out questions that have already been answered by the player
SELECT 1
FROM answers
WHERE answers.game_id = game_questions.game_id
AND answers.player_name = $player
AND answers.question_id = game_questions.question_id
)
ORDER BY game_order
LIMIT 1
),
next_page as (
SELECT * FROM next_question
UNION ALL
SELECT 'game-over.sql' as page, json_object('game_id', $game_id) as params
WHERE NOT EXISTS (SELECT 1 FROM next_question)
)
SELECT 'redirect' as component,
sqlpage.link(page, params) as link
FROM next_page
LIMIT 1;
+34
View File
@@ -0,0 +1,34 @@
select * FROM sqlpage_shell;
SELECT 'form' as component,
question_text as title,
'Submit your answer' as validate,
sqlpage.link('wait.sql', json_object('game_id', $game_id, 'question_id', $question_id, 'player', $player)) as action
FROM questions
where id = $question_id::integer;
SELECT 'answer' as name,
CASE
$player
WHEN impostor THEN 'Try to trick the other players into answering: ' || wrong_answer || ', but try to make your own answer correct.'
ELSE 'Discuss the question with the other players and then submit your answer'
END as label,
'Your answer' as placeholder,
'number' as type,
TRUE as required,
TRUE as autofocus,
0 as min
FROM game_questions
WHERE game_id = $game_id::integer
AND question_id = $question_id::integer;
SELECT 'alert' as component,
'red' as color,
'Make them guess: ' || wrong_answer as title,
'You are the impostor!
Your goal is to sabotage the game by making others give an answer that will be closer to ' || wrong_answer || ' than to the true answer.
The more other players you manage to trick, the more points you will get.' as description
FROM game_questions
WHERE game_id = $game_id::integer
AND impostor = $player
AND question_id = $question_id::integer;
+30
View File
@@ -0,0 +1,30 @@
select * FROM sqlpage_shell;
SELECT 'steps' as component,
1 as counter,
'cyan' as color,
'Game rules' as title;
SELECT 'Create game' as title,
'plus' as icon,
'Create a new game from the home page.' as description;
SELECT 'Add players' as title,
'user-plus' as icon,
'Add players by their name, and send them their own unique game URL.' as description;
SELECT 'Answer questions' as title,
'Answer trivia questions to get points. Don''t be fooled by the imposter.' as description,
'help-hexagon' as icon;
SELECT 'Trick the others' as title,
'When you become the imposter, try to trick the others into giving wrong answers.' as description,
'help-hexagon' as icon;
SELECT 'The smartest wins' as title,
'In the end, the game counts your points. You win if you tricked the others and did not get tricked.' as description,
'brain' as icon;
select 'card' as component, 1 as columns;
SELECT 'Objective' as title, 'As a team of genuine employees, your goal is to make accurate decisions based on challenging questions. The infiltrator''s objective is to sway you toward incorrect answers.' as description;
SELECT 'Gameplay' as title, 'Each turn, a question will be presented to the group. One player, secretly assigned as the infiltrator, will receive a specific wrong answer. They must cunningly lead others astray, while you must collaborate and deduce the correct answer. Every player will be the infiltrator once during the game.' as description;
SELECT 'Discussion Phase' as title, 'Engage in lively debates and exchange ideas to uncover the truth. Analyze arguments, question motives, and use your critical thinking skills to navigate the murky waters of corporate deception.' as description;
SELECT 'Hidden Votes' as title, 'After the discussion phase, all players simultaneously submit their individual answers privately, without revealing them to others. Votes will not be revealed until the end of the game.' as description;
SELECT 'Scoring System' as title, 'Points are awarded based on the proximity of each player''s answer to the true answer.
If a player''s answer is closer to the true answer than to the wrong answer provided by the saboteur, they earn one point.
Conversely, if a player''s answer is closer to the wrong answer, they inadvertently contribute one point to the saboteur''s score.' as description;
SELECT 'Continuing Gameplay' as title, 'The game progresses with new questions and role assignments, allowing each player to take turns as the infiltrator. The player with the highest score at the end of the predetermined number of rounds wins the game.' as description;
@@ -0,0 +1,63 @@
CREATE TABLE games (
id INTEGER PRIMARY KEY,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE players (
name TEXT NOT NULL,
game_id INTEGER NOT NULL,
PRIMARY KEY (name, game_id),
FOREIGN KEY (game_id) REFERENCES games(id)
);
CREATE TABLE questions (
id INTEGER PRIMARY KEY,
question_text TEXT,
category CHAR(4),
explanation TEXT,
true_answer INTEGER
);
CREATE TABLE game_questions (
game_id INTEGER,
question_id INTEGER,
wrong_answer INTEGER, -- the wrong answer that the impostor will try to convince others is correct
impostor TEXT, -- the player who will receive the wrong answer
game_order INTEGER, -- indicates the order in which the questions are asked
PRIMARY KEY (game_id, question_id),
FOREIGN KEY (question_id) REFERENCES questions(id),
FOREIGN KEY (game_id, impostor) REFERENCES players(game_id, name)
);
CREATE TABLE answers (
game_id INTEGER,
player_name TEXT,
question_id INTEGER,
answer_value INTEGER,
PRIMARY KEY (game_id, question_id, player_name),
FOREIGN KEY (game_id) REFERENCES games(id),
FOREIGN KEY (player_name, game_id) REFERENCES players(name, game_id),
FOREIGN KEY (question_id) REFERENCES questions(id)
);
CREATE VIEW game_results AS
SELECT answers.game_id,
player_name,
impostor,
abs(answer_value - true_answer) > abs(answer_value - wrong_answer) as impostor_won
FROM answers
INNER JOIN game_questions ON answers.question_id = game_questions.question_id AND answers.game_id = game_questions.game_id
INNER JOIN questions ON game_questions.question_id = questions.id;
-- transform the above to a create view
CREATE VIEW sqlpage_shell AS
SELECT
'shell' AS component,
'Corporate Conundrum' AS title,
'Unleash your inner executive in this thrilling board game of corporate espionage. Make the right choices to lead your company to success!' AS description,
'affiliate' AS icon,
'/' AS link,
'["New Game", "rules"]' AS menu_item,
'Libre Baskerville' AS font,
'en-US' AS lang
;
@@ -0,0 +1,497 @@
INSERT INTO questions (
question_text,
category,
explanation,
true_answer
)
VALUES (
'How tall is the Eiffel Tower in meters (including the tip)?',
'GEOG',
'The Eiffel Tower stands at a height of 330 meters, including the tip. This measurement includes the pinnacle that crowns the tower, providing an accurate representation of its total height from the ground to the highest point.',
330
),
(
'When was the first submarine built?',
'HIST',
'The first submersible of whose construction there exists reliable information was designed and built in 1620 by Cornelis Drebbel, a Dutchman in the service of James I of England.',
1620
),
(
'How many planets are in our solar system?',
'SCIE',
'There are eight planets in our solar system: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune.',
8
),
(
'How many bones are there in the human body?',
'SCIE',
'The human body has 206 bones. This count includes all the bones in the skeleton, ranging from the tiny bones in the ear to the larger bones in the arms, legs, spine, and skull. The number of bones can vary slightly due to fusion of certain bones during growth and development.',
206
),
(
'How many symphonies did Ludwig van Beethoven compose?',
'MUSI',
'Recognised as one of the greatest and most influential composers of the Western classical tradition, he defied the onset of deafness from the age of 28 to produce an output that encompasses 722 works, including 9 symphonies, 35 piano sonatas and 16 string quartets.',
9
),
(
'In what year did George Washington die?',
'HIST',
'George Washington (February 22, 1732 December 14, 1799) was an American political leader, military general, statesman, and Founding Father who served as the first president of the United States from 1789 to 1797.',
1799
),
(
'What is the size (diameter) of Jupiter in kilometers ?',
'SCIE',
'Jupiter is the largest planet in our solar system at nearly 11 times the size of Earth and 317 times its mass.',
139820
),
(
'What is the population of Australia in millions ?',
'GEOG',
'The population of Australia is estimated to be around 27 millions in 2023. Australia is the 55th most populous country in the world.',
27
),
(
'what is the population of Kazakhstan in millions ?',
'GEOG',
'It has a population of 19 million people and one of the lowest population densities in the world, at fewer than 6 people per square kilometre.',
19
),
(
'How many stairs are there in the Eiffel Tower?',
'GEOG',
'There are 1665 steps in the Eiffel Tower.',
1665
),
(
'How heavy is the Empire State Building in tons?',
'GEOG',
'The Empire State Building weighs approximately 365,000 tons.',
365000
),
(
'How many people die in car crashes globally every day?',
'SCIE',
'Approximately 3,700 people die in car crashes every day around the world.',
3700
),
(
'How many liters of pure alcohol do people drink per year in the world ?',
'SCIE',
'The average person (aged 15 years or older) consumes 6 liters of pure alcohol per year, according to the latest data from the World Health Organization.',
6
),
(
'In what year was Nigeria formed ?',
'HIST',
'Lagos was occupied by British forces in 1851 and formally annexed by Britain in the year 1865. Nigeria became a British protectorate in 1901.The period of British rule lasted until 1960 when an independence movement led to the country being granted independence.',
1960
),
(
'In what year was Gandhi assassinated ?',
'HIST',
'Mohandas Karamchand Gandhi was assassinated on 30 January 1948 in the compound of Birla House (now Gandhi Smriti), a large mansion in New Delhi.',
1948
),
(
'How many babies are born each second in the world ?',
'SCIE',
'Around 140 million babies are born every year in the world. That''s a little more than four births every second of every day.',
4
),
(
'How old was the oldest iguana to ever live ?',
'SCIE',
'An almost 41-year-old Rhinoceros Iguana in Australia Zoo has made won an honour for world''s oldest living one in captivity. Iguana named Rhino, which is soon to turn 41 received the Guinness World Record for being the World''s Oldest Iguana.',
41
),
(
'How many countries are there in Africa?',
'GEOG',
'There are 54 countries in Africa.',
54
),
(
'How many players are there on a polo team?',
'SPORTS',
'A polo team is comprised of four players.The object of the game is to move the polo ball down the field,
hitting the ball through the goal posts to score.',
4
),
(
'What is the atomic number of oxygen?',
'SCIE',
'The atomic number of oxygen is 8.',
8
),
(
'What is the current population of China in millions?',
'GEOG',
'The current population of China is 1.4 billion.',
1444
),
(
'How many planets are closer to the Sun than Earth?',
'SCIE',
'There are two planets closer to the Sun than Earth: Mercury and Venus.',
2
),
(
'How many time zones are there in Kazakhstan ?',
'GEOG',
'Even though its territory spans four geographical time zones (from +3 to +6), standard time in Kazakhstan
is either UTC+05:00 or UTC+06:00.
These times apply throughout the year as Kazakhstan does not observe Daylight saving time.',
2
),
(
'What is the speed limit in the United Arab Emirates on the Sheikh Khalifa highway in kilometers per hour ?',
'SCIE',
'The UAE is notable for having the highest posted speed limits in the world, with two major highways, the Abu Dhabi-Al Ain highway and the Sheikh Khalifa highway, both
having limits of 160 km / h (99 mph).Speed limits in the Emirate of Abu Dhabi are generally higher than the other Emirates.The general speed
limit in Abu Dhabi is 140 km / h whereas in Dubai it is 110 km / h and in the Northern Emirates its 120km / h.',
160
),
(
'How many chambers are there in a human heart?',
'SCIE',
'There are four chambers in a human heart: two atria and two ventricles.',
4
),
(
'What is the highest score achievable in a game of bowling?',
'SPORTS',
'A perfect game is the highest score possible in a game of bowling, achieved by scoring a strike in every frame.
In common bowling games (that use 10 pins) the highest possible score is 300, achieved by bowling 12 strikes
in a row in a traditional single game: one strike in each of the first nine frames, and three more in the tenth frame.',
300
),
(
'How many bones are there in the human body?',
'SCIE',
'An adult human body has 206 bones.',
206
),
(
'What is the population of India in millions?',
'GEOG',
'The population of India is around 1408 millions.',
1408
),
(
'How many Grand Slam titles has Serena Williams won?',
'SPORTS',
'Serena Williams has won 23 Grand Slam singles titles.',
23
),
(
'What is the record for the fastest 100-meter sprint in milliseconds?',
'SPORTS',
'The current record for the fastest 100-meter sprint is 9.58 seconds, set by Usain Bolt in 2009.',
9580
),
(
'How many elements are there in the periodic table?',
'SCIE',
'There are currently 118 known elements in the periodic table.',
118
),
(
'What is the diameter of the Moon in kilometers?',
'SCIE',
'The diameter of the Moon is approximately 3,474 kilometers.',
3474
),
(
'How many strings does a violin have?',
'MUSI',
'A violin typically has 4 strings.',
4
),
(
'What is the speed of sound in meters per second?',
'SCIE',
'The speed of sound in dry air at 20 degrees Celsius is approximately 343 meters per second.',
343
),
(
'How many Oscars did the movie "Titanic" win?',
'MUSI',
'The movie "Titanic" won 11 Oscars.',
11
),
(
'In what year did the Battle of Agincourt take place?',
'HIST',
'The Battle of Agincourt was a major English victory in the Hundred Years'' War. It was fought on 25 October 1415.',
1415
),
(
'When did the Ming Dynasty establish its rule in China?',
'HIST',
'The Ming Dynasty ruled China from 1368 to 1644, following the collapse of the Mongol-led Yuan Dynasty.',
1368
),
(
'When did the Byzantine Empire fall to the Ottoman Turks?',
'HIST',
'The Fall of Constantinople was the capture of the capital of the Byzantine Empire by an invading Ottoman army on 29 May 1453.',
1453
),
(
'When did the Black Death pandemic arrive in Europe?',
'HIST',
'The Black Death, also known as the Bubonic Plague, ravaged Europe from 1347 to 1351, causing widespread death and social upheaval.',
1347
),
(
'In what year did the Opium Wars between China and Britain start?',
'HIST',
'The Opium Wars were a series of conflicts between the Qing Dynasty of China and the British Empire. The First Opium War occurred from 1839 to 1842.',
1839
),
(
'When was the Great Fire of London?',
'HIST',
'The Great Fire of London was a major conflagration that swept through the central parts of the city from 2 to 6 September 1666.',
1666
),
(
'In what year did the Sengoku period start in Japan?',
'HIST',
'The Sengoku period (''Warring States period'') is the period in Japanese history in which civil wars and social upheavals
took place almost continuously in the 15th and 16th centuries.
Though the Ōnin War (1467) is generally chosen as the Sengoku period''s start date,
there are many competing historiographies for its end date, ranging from 1568, the date of Oda Nobunaga''s march on Kyoto,
to the suppression of the Shimabara Rebellion in 1638',
1467
),
(
'In what year was "Pride and Prejudice" by Jane Austen first published?',
'LITE',
'Jane Austen''s "Pride and Prejudice" was first published in 1813. It is a classic novel of manners that explores themes of love, marriage, and societal expectations.',
1813
),
(
'How many chapters are there in "Moby-Dick" by Herman Melville?',
'LITE',
'"Moby-Dick" by Herman Melville consists of 135 chapters. This epic novel tells the story of Captain Ahab''s quest for revenge against the white whale, Moby Dick.',
135
),
(
'In what year was "To Kill a Mockingbird" by Harper Lee published?',
'LITE',
'"To Kill a Mockingbird" was first published in 1960. The novel explores themes of racial injustice and the loss of innocence through the eyes of Scout Finch.',
1960
),
(
'How many volumes make up Marcel Proust''s "In Search of Lost Time"?',
'LITE',
'Marcel Proust''s "In Search of Lost Time" is a seven-volume novel. It is considered one of the greatest works of modernist literature.',
7
),
(
'In what year was "The Catcher in the Rye" by J.D. Salinger published?',
'LITE',
'"The Catcher in the Rye" was first published in 1951. The novel follows the rebellious teenager Holden Caulfield as he navigates adolescence and society.',
1951
),
(
'How many sisters are there in Louisa May Alcott''s "Little Women"?',
'LITE',
'"Little Women" by Louisa May Alcott features four sisters: Meg, Jo, Beth, and Amy. The novel explores their coming of age and their relationships with each other.',
4
),
(
'In what year was "1984" by George Orwell published?',
'LITE',
'"1984" by George Orwell was published in 1949. It is a dystopian novel that depicts a totalitarian society where individuality and independent thinking are suppressed.',
1949
),
(
'How many chapters are there in F. Scott Fitzgerald''s "The Great Gatsby"?',
'LITE',
'"The Great Gatsby" by F. Scott Fitzgerald consists of 9 chapters. The novel explores themes of wealth, love, and the American Dream during the Roaring Twenties.',
9
),
(
'In what year was "Don Quixote" by Miguel de Cervantes first published?',
'LITE',
'"Don Quixote" by Miguel de Cervantes was first published in 1605. It is considered one of the most important works of literature and is often regarded as the first modern novel.',
1605
),
(
'How many volumes make up J.R.R. Tolkien''s "The Lord of the Rings" trilogy?',
'LITE',
'J.R.R. Tolkien''s "The Lord of the Rings" trilogy consists of three volumes: "The Fellowship of the Ring," "The Two Towers," and "The Return of the King."',
3
),
(
'In what year was "Crime and Punishment" by Fyodor Dostoevsky first published?',
'LITE',
'"Crime and Punishment" by Fyodor Dostoevsky was first published in 1866. The novel explores the psychological turmoil of the main character, Raskolnikov.',
1866
),
(
'How many parts are there in Victor Hugo''s "Les Misérables"?',
'LITE',
'"Les Misérables" by Victor Hugo is divided into five parts. The novel follows the lives of several characters amidst the backdrop of social and political unrest in 19th-century France.',
5
),
(
'In what year was "The Hobbit" by J.R.R. Tolkien published?',
'LITE',
'"The Hobbit" by J.R.R. Tolkien was first published in 1937. It is a fantasy novel that serves as a prelude to Tolkien''s later work, "The Lord of the Rings."',
1937
),
(
'How many players are there in a Kabaddi team?',
'SPORTS',
'A Kabaddi team consists of 7 players on the field. Kabaddi is a popular contact team sport originating from ancient India.',
7
),
(
'What is the maximum score achievable with a single dart in a game of darts?',
'SPORTS',
'The maximum score achievable with a single dart in a game of darts is 60. This can be achieved by hitting the triple 20 segment.',
60
),
(
'How many players are there on an Australian Rules Football team?',
'SPORTS',
'An Australian Rules Football team has 18 players on the field at any given time. Australian Rules Football is a unique and popular sport in Australia.',
18
),
(
'What is the length of a cricket pitch in yards?',
'SPORTS',
'The length of a cricket pitch is 22 yards, which is equivalent to approximately 20.12 meters. Cricket is a widely played sport in many countries.',
22
),
(
'How many players are there on a water polo team?',
'SPORTS',
'A water polo team consists of 7 players in the water at a time, including the goalkeeper. Water polo is a competitive water sport played in a pool.',
7
),
(
'What is the weight of a standard table tennis ball in milligrams?',
'SPORTS',
'A standard table tennis ball weighs approximately 2.7 grams. Table tennis, also known as ping pong, is a popular indoor sport.',
2700
),
(
'How many rounds are there in professional boxing championship fights?',
'SPORTS',
'Professional boxing championship fights typically have 12 rounds. Each round is usually 3 minutes long, with a minute of rest in between.',
12
),
(
'What is the maximum score a gymnast can achieve on a single apparatus in artistic gymnastics?',
'SPORTS',
'In artistic gymnastics, the maximum score a gymnast can achieve on a single apparatus is 10. The score is based on a combination of difficulty and execution.',
10
),
(
'What is the length of an Olympic-sized swimming pool in meters?',
'SPORTS',
'An Olympic-sized swimming pool has a length of 50 meters. It is the standard length for competitive swimming events in the Olympics.',
50
),
(
'How many symphonies did Wolfgang Amadeus Mozart compose?',
'ARTS',
'Wolfgang Amadeus Mozart composed a total of 41 symphonies. His symphonies are considered masterpieces of classical music.',
41
),
(
'What is the duration of Beethoven''s Symphony No. 9 in minutes ?',
'ARTS',
'Beethoven''s Symphony No. 9, also known as the "Choral Symphony," has a duration of approximately 70 minutes. It is one of Beethoven''s most famous and enduring works.',
70
),
(
'How many acts are there in William Shakespeare''s play "Hamlet"?',
'ARTS',
'William Shakespeare''s play "Hamlet" is divided into five acts. It is a tragedy that explores themes of revenge, madness, and moral corruption.',
5
),
(
'In what year was Vincent van Gogh''s painting "Starry Night" created?',
'ARTS',
'Vincent van Gogh''s painting "Starry Night" was created in the year 1889. It is one of his most famous and recognizable works.',
1889
),
(
'How many sonnets did William Shakespeare write?',
'ARTS',
'William Shakespeare wrote a total of 154 sonnets. His sonnets are considered some of the greatest poetry in the English language.',
154
),
(
'How many ranks are there in the hierarchy of the Paris Opera Ballet?',
'ARTS',
'There are five ranks of dancers in the Paris Opera Ballet; from highest to lowest they are: Danseur Étoile, premier danseur, sujet, coryphée, and quadrille.',
5
),
(
'What is the total number of keys on a standard piano?',
'ARTS',
'A standard piano has a total of 88 keys. These keys include both white keys and black keys, spanning several octaves.',
88
),
(
'How many acts are there in Giuseppe Verdi''s opera "La Traviata"?',
'ARTS',
'Giuseppe Verdi''s opera "La Traviata" is divided into three acts. It is a tragic love story set in 19th-century Paris.',
3
),
(
'What is the running time of the film "Gone with the Wind" in minutes ?',
'ARTS',
'The film "Gone with the Wind," directed by Victor Fleming, has a running time of approximately 3 hours and 58 minutes. It is an epic historical romance set during the American Civil War.',
238
),
(
'How many atoms of carbon are there in a molecule of glucose?',
'SCIE',
'A molecule of glucose (C6H12O6) contains 6 atoms of carbon. Glucose is a simple sugar and an important source of energy in biological systems.',
6
),
(
'What is the atomic number of gold?',
'SCIE',
'The atomic number of gold is 79. Gold is a dense, soft, and highly valuable metal known for its lustrous yellow appearance.',
79
),
(
'How many chromosomes are found in a human somatic cell?',
'SCIE',
'A human somatic cell typically contains 46 chromosomes. These chromosomes carry genetic information and are located in the nucleus of the cell.',
46
),
(
'How many chambers are there in the heart of a frog?',
'SCIE',
'Unlike humans and other mammals, frogs have a three-chambered heart consisting of two atria and one ventricle. This unique cardiac structure allows for efficient circulation in amphibians.',
3
),
(
'What is the boiling point of liquid nitrogen in Kelvins?',
'SCIE',
'Liquid nitrogen has a boiling point of approximately -196 degrees Celsius, or 77 Kelvins. It is commonly used in various scientific and industrial applications due to its extremely low temperature.',
77
),
(
'How many bones are there in the human hand?',
'SCIE',
'The human hand is composed of 27 bones. These bones include the eight carpal bones in the wrist, five metacarpal bones in the palm, and 14 phalanges in the fingers.',
27
),
(
'What is the pH value of pure water at room temperature?',
'SCIE',
'Pure water at room temperature has a pH value of approximately 7, making it neutral on the pH scale. This means that it is neither acidic nor alkaline.',
7
);
+55
View File
@@ -0,0 +1,55 @@
GET http://localhost:8080
HTTP 200
[Asserts]
body contains "Welcome to Corporate Conundrum"
body contains "Start a New Game"
body not contains "An error occurred"
GET http://localhost:8080/New%20Game.sql
HTTP 302
[Captures]
game_id: header "Location" regex "id=(-?\\d+)"
[Asserts]
header "Location" matches "^game\\.sql\\?id=-?\\d+$"
GET http://localhost:8080/game.sql?id={{game_id}}&Player=Alice
HTTP 200
[Asserts]
body contains "Players"
body contains "Alice"
body contains "Add a new player"
body not contains "An error occurred"
GET http://localhost:8080/next-question.sql?game_id={{game_id}}&player=Alice
HTTP 302
[Captures]
question_id: header "Location" regex "question%5Fid=(\\d+)"
[Asserts]
header "Location" contains "question.sql"
header "Location" contains "player=Alice"
GET http://localhost:8080/question.sql?game_id={{game_id}}&question_id={{question_id}}&player=Alice
HTTP 200
[Asserts]
body contains "Submit your answer"
body contains "Your answer"
body not contains "An error occurred"
GET http://localhost:8080/wait.sql?game_id={{game_id}}&question_id={{question_id}}&player=Alice&answer=42
HTTP 200
[Asserts]
body contains "Waiting for other players to answer"
body not contains "An error occurred"
GET http://localhost:8080/next-question.sql?game_id={{game_id}}&player=Alice
HTTP 302
[Asserts]
header "Location" contains "game-over.sql"
GET http://localhost:8080/game-over.sql?game_id={{game_id}}
HTTP 200
[Asserts]
body contains "The game is over"
body contains "Scores"
body contains "Alice"
body not contains "An error occurred"
+32
View File
@@ -0,0 +1,32 @@
-- Redirect to the next question when all players have answered
set page_params = json_object('game_id', $game_id, 'player', $player);
select CASE
(SELECT count(*) FROM answers WHERE question_id = $question_id AND game_id = CAST($game_id AS INTEGER))
WHEN (SELECT count(*) FROM players WHERE game_id = CAST($game_id AS INTEGER))
THEN '0; ' || sqlpage.link('next-question.sql', $page_params)
ELSE 3
END as refresh,
sqlpage_shell.*
FROM sqlpage_shell;
-- Insert the answer into the answers table
INSERT INTO answers(game_id, player_name, question_id, answer_value)
SELECT CAST($game_id AS INTEGER) as game_id,
$player as player_name,
CAST($question_id AS INTEGER) as question_id,
CAST($answer AS INTEGER) as answer_value
WHERE $answer IS NOT NULL;
-- Redirect to the next question
SELECT 'text' as component,
'Waiting for other players to answer... The following players still have not answered: ' as contents;
select group_concat(name, ', ') as contents,
TRUE as bold
from players
where game_id = CAST($game_id AS INTEGER)
and not EXISTS (
SELECT 1
FROM answers
WHERE answers.game_id = CAST($game_id AS INTEGER)
AND answers.player_name = players.name
AND answers.question_id = CAST($question_id AS INTEGER)
);