Package: codegame
OverviewTheCodegame Platformis a Python desktop application to create, distribute, discover, and runcodegames.Acodegameis aserious gamemade of levels written inLitemark, a lightweightMarkdowndialect.A level is typically a hypertext that gratifies intellectual curiosity, with an embedded programming problem to solve.The person who produces acodegameis thecreator. The one who consumes acodegameis theuser.The creator can safely insert problems testing specifications in a level. The Codegame Platform evaluates the solution submitted by the user then unlock the next level if the solution is correct.This project is suitable for:teaching programming, algorithms, data structures;building a well-articulated chain of puzzles with an exciting story behind it;automatingcoding interviews;fun, and more...Now, let's build a codegame demo with the Codegame Platform.InstallationFor the first time$pipinstallcodegameUpgrade$pipinstallcodegame--upgrade--upgrade-strategyeagerCodegame creationThe Codegame Platform has a command line interface to create, build and publish codegames.InitializationChange the current working directory to the folder of the new codegame project. Then use the commandinitto initialize the folder.$cd/home/alex/cgame-demo
$codegameinitNow you have a basic codegame project structure.Basic codegame structureThis is the root directory of the codegame project:cgame-demo/assets/# [1] this is where you store imagesdist/# [2] folder to keep distribution packagessource/# [3] the main folder to store levels !CHANGELOG.md# [4] automatically updatedcodegame.json# [5] the config file of the projectLATEST_RELEASE.md# [6] latest releaseREADME.md# [7][1]this is just a convention, you can ignore this folder and put your images somewhere else.[2]distribution packages are just ZIP archives generated by the Codegame Platform when you issue the commandbuild. You won't need to enter this directory since it's managed by the Codegame Platform.[3]this is where you store the Litemark files that represent the levels of your codegame.[4]this file is managed by the Codegame Platform.[5]when you issue the commandinitfor the first time, you will be asked to submit some information (author name, github repository...). This information is stored in this config file that you can edit.[6]when you issue the commandpublish, the content of this file is automatically cut and pasted in CHANGELOG.md.[7]there are some basic README text in this file that you can edit.Note: don't forget to add a license file in the root directory of the codegame project.Levels for this demoLet's edit the foldersource:source/1.md# level 12.md# level 23.md# level 3index.json# we will store levels titles hereThis is the content ofindex.json:["Welcome Dear Stranger !","Time Is Money...","The Year Of The Four Seasons"]Each level is just a file with Litemark text inside.
You can preview the rendered level with the commandpreview:# cd to the root directory of the codegame project$cd/home/alex/cgame-demo# without any argument, this command will open the first level$codegamepreview# preview level 3$codegamepreview3Embed a problem in a levelThe Codegame Platform introduces a new level to the user when they complete the problem defined in the previous level.
To insert a problem into a level, all you need to do is insert the test specifications to evaluate the solution in a special codeblock calledcodegame-test. The Codegame Platform will insert aSOLVE ME !Button at the bottom of the level page. If the user clicks on the button, they will be prompted to submit a solution in an editor that will open. If the solution passes the tests, aNEXT LEVELbutton will be inserted at the bottom of the level page.Let's explore the content of the 3 levels in this codegame demo project.Codegame demo levelsYou can clone thecodegame demoproject to study it:$gitclonehttps://github.com/pyrustic/cgame-demoLevel 1$cd/home/alex/cgame-demo
$codegamepreview1Rendered - Codegame demo - Level 1 (Preview)Plain text - Codegame demo - Level 1Level 2$cd/home/alex/cgame-demo
$codegamepreview2Rendered - Codegame demo - Level 2 (Preview)Plain text - Codegame demo - Level 2Level 3$cd/home/alex/cgame-demo
$codegamepreview3Rendered - Codegame demo - Level 3 (Preview)Plain text 1/2 - Codegame demo - Level 3Plain text 2/2 - Codegame demo - Level 3DistributionBuild$cd/home/alex/cgame-demo
$codegamebuildPublish$cd/home/alex/cgame-demo
$codegamepublishCheck downloads and stargazers$cd/home/alex/cgame-demo
$codegameinforemote# or$codegameinfohttps://github.com/pyrustic/cgame-demo# or$codegameinfopyrustic/cgame-demoInstall a new codegame from the GUIOpen the GUI of theCodegame Platform:$codegameThen copy-paste in the search bar the GitHub repository URL (or the shortcut "owner/repository") of thecodegameto install.The Codegame Platform GUIInstalling the codegame demoSolving the Level 1 of the codegame demoSolved Level 1 of the codegame demoThe GUI of theCodegame Platformis inspired byHubstore. VisitHubstore!This project is a work in progress...