Popular recipes tagged "game" but not "artificial_intelligence" and "python"http://code.activestate.com/recipes/tags/game-artificial_intelligence-python/2016-09-19T18:03:09-07:00ActiveState Code RecipesReversi Othello (Python) 2016-09-19T18:03:09-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/580698-reversi-othello/ <p style="color: grey"> Python recipe 580698 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/ai/">ai</a>, <a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/games/">games</a>). </p> <p>Reversi/Othello Board Game using Minimax, Alpha-Beta Pruning, Negamax, Negascout algorithms.</p> chroma (Python) 2016-05-30T11:48:10-07:00aaahttp://code.activestate.com/recipes/users/4194184/http://code.activestate.com/recipes/580671-chroma/ <p style="color: grey"> Python recipe 580671 by <a href="/recipes/users/4194184/">aaa</a> (<a href="/recipes/tags/2d/">2d</a>, <a href="/recipes/tags/game/">game</a>). </p> <p>Python personnal game code</p> high precision FPS (Python) 2015-05-12T12:04:38-07:00Jiri Justrahttp://code.activestate.com/recipes/users/4192188/http://code.activestate.com/recipes/579053-high-precision-fps/ <p style="color: grey"> Python recipe 579053 by <a href="/recipes/users/4192188/">Jiri Justra</a> (<a href="/recipes/tags/fps/">fps</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/games/">games</a>, <a href="/recipes/tags/pure/">pure</a>). Revision 2. </p> <p>This code adjust itself for set FPS value. It is much more precise that time.sleep fps implementation.</p> Guess a number 2 (the computer attempts to guess your number) (Python) 2014-11-15T12:11:16-08:00Benoithttp://code.activestate.com/recipes/users/4191135/http://code.activestate.com/recipes/578963-guess-a-number-2-the-computer-attempts-to-guess-yo/ <p style="color: grey"> Python recipe 578963 by <a href="/recipes/users/4191135/">Benoit</a> (<a href="/recipes/tags/ai/">ai</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/sample/">sample</a>). Revision 2. </p> <p>Guess a number was part 1 was Human trying to guess a random number between 1 and 100 in 10 tries. This time the computer is trying to guess. Simple program for beginner to learn very simple formula as a start to an algorithm for AI. And conditional choice. The program is not perfect, as it will not force a victory when the computer guessed right, neither it can control if you cheated or not. But this is not the goal here. </p> Guess a number (Python) 2014-11-15T09:06:05-08:00Benoithttp://code.activestate.com/recipes/users/4191135/http://code.activestate.com/recipes/578962-guess-a-number/ <p style="color: grey"> Python recipe 578962 by <a href="/recipes/users/4191135/">Benoit</a> (<a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/random/">random</a>, <a href="/recipes/tags/sample/">sample</a>). </p> <p>This is just a little game to explain some very basic function in Python for beginner. RANDOM, Loop, Try and except... </p> Droids ( a text adventure ) (Python) 2013-07-27T09:44:06-07:00jayhttp://code.activestate.com/recipes/users/4186699/http://code.activestate.com/recipes/578618-droids-a-text-adventure/ <p style="color: grey"> Python recipe 578618 by <a href="/recipes/users/4186699/">jay</a> (<a href="/recipes/tags/beginner/">beginner</a>, <a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/text/">text</a>). </p> <p>for beginners.</p> Droids 2 ( IF ) (Python) 2013-08-13T09:12:11-07:00jayhttp://code.activestate.com/recipes/users/4186699/http://code.activestate.com/recipes/578636-droids-2-if/ <p style="color: grey"> Python recipe 578636 by <a href="/recipes/users/4186699/">jay</a> (<a href="/recipes/tags/beginner/">beginner</a>, <a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/if/">if</a>, <a href="/recipes/tags/learning/">learning</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/text/">text</a>). Revision 2. </p> <h4 id="-for-learners-and-beginners-like-myself-">-For learner's and beginner's like myself -</h4> <h4 id="-and-for-anyone-who-may-have-enjoyed-droids-">-and for anyone who may have enjoyed Droids. -</h4> Random Maze Generator (Python) 2012-12-14T09:09:22-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/578356-random-maze-generator/ <p style="color: grey"> Python recipe 578356 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/ai/">ai</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/pil/">pil</a>). Revision 2. </p> <p>Random maze generator using depth-first search.</p> <p>It starts the maze path from a random cell and there is no exit defined but actually any 2 cells on the path (white cells) can be assigned to be entry and exit locations. (I could just add code to randomly select 2 white cells and change their colors to something else but I thought it looks better this way.)</p> Random Multi-Maze Generator (Python) 2012-12-14T11:23:29-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/578378-random-multi-maze-generator/ <p style="color: grey"> Python recipe 578378 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/ai/">ai</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/pil/">pil</a>). </p> <p>Randomly creates mazes which have multiple paths to solve. Entry and exit points for each path can be assigned arbitrarily. (I never seen this kind of maze anywhere before but I think calling them multi-maze should be okay.)</p> War Game (Version 5) (Python) 2012-12-07T01:40:06-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578369-war-game-version-5/ <p style="color: grey"> Python recipe 578369 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/card/">card</a>, <a href="/recipes/tags/demonstration/">demonstration</a>, <a href="/recipes/tags/game/">game</a>). </p> <p>Part of the War Game set, this version of War Game further advanced the program in an environment without curses. Showing another iteration of development, the recipe here program for more fun with a virtual card game and ASCII graphic card representations while playing.</p> War Game (Version 6) (Python) 2012-12-07T01:49:19-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578370-war-game-version-6/ <p style="color: grey"> Python recipe 578370 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/card/">card</a>, <a href="/recipes/tags/demonstration/">demonstration</a>, <a href="/recipes/tags/game/">game</a>). </p> <p>As the final version of the War Game, development finally came to a halt as the prototype exceeded it bounds for design. Yes, you can write your program as one large function, but should you? This recipe demonstrates that program without proper style can lead to a mess very quickly. Practice good coding standards, or you can easily loose focus and the ability to maintain your code.</p> War Card Game Simulation (Python) 2012-07-01T01:23:03-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578179-war-card-game-simulation/ <p style="color: grey"> Python recipe 578179 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/automatically/">automatically</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/simulation/">simulation</a>). </p> <p>After playing the card game with people for the first time, the game turned out to be rather boring. The way we played took absolutely no thought whatsoever and turned out to be very easy to automate. The game below is configured for four different players to complete the simple game until it ends. Each player's hand in printed, and the cards played in each round is shown till someone finishes. Whoever wins is shown at the end of the simulation, and the program quickly exits when complete.</p> A-star Shortest Path Algorithm (C++) 2010-12-25T23:36:35-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577457-a-star-shortest-path-algorithm/ <p style="color: grey"> C++ recipe 577457 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/graph/">graph</a>, <a href="/recipes/tags/graphs/">graphs</a>, <a href="/recipes/tags/routes/">routes</a>). Revision 4. </p> <p>A-star (A*) is a shortest path algorithm widely used for RTS games, GPS navigation etc.</p> Random Number Game (C) 2012-03-29T03:47:52-07:00Jacob A. Bridgeshttp://code.activestate.com/recipes/users/4181498/http://code.activestate.com/recipes/578088-random-number-game/ <p style="color: grey"> C recipe 578088 by <a href="/recipes/users/4181498/">Jacob A. Bridges</a> (<a href="/recipes/tags/c/">c</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/guessing/">guessing</a>, <a href="/recipes/tags/number/">number</a>). </p> <p>An old game I created freshman year of college. For use on Windows OS only. (The code contains a few Windows system calls.)</p> An extensible Conway's Game of Life (Python) 2011-12-05T11:45:45-08:00Filippo Squillacehttp://code.activestate.com/recipes/users/4174931/http://code.activestate.com/recipes/577976-an-extensible-conways-game-of-life/ <p style="color: grey"> Python recipe 577976 by <a href="/recipes/users/4174931/">Filippo Squillace</a> (<a href="/recipes/tags/animation/">animation</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/life/">life</a>). </p> <p>This program is an extensible Conway's game of life. It allows to define different type of grid (for example 2D or 3D) and more complex rules. Each grid inherits an Abstract grid that implement the method (next()) to pass for the next configuration. Furthermore, each element can be whatever type. In this example I designed Grid2DBool that represent the simple Conway's game of life, but could be possible to develop and easily implement more complex grids and rules.</p> <p>Note: The demo save also the animation in a file .mp4 and plot it through pyplot. The demo could take long time because of storing all the configurations before showing the animation. Therefore, the visualization can be improved using other libraries (as wxpython) that paint the configuration of the grid once it's created. With a more complex view it's convenient to apply MVC pattern declaring the model AbstractGrid as the Observable class.</p> Sound in the STL (Python) 2011-08-15T09:28:12-07:00Russell Fosterhttp://code.activestate.com/recipes/users/4178972/http://code.activestate.com/recipes/577843-sound-in-the-stl/ <p style="color: grey"> Python recipe 577843 by <a href="/recipes/users/4178972/">Russell Foster</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/stl/">stl</a>). </p> <p>I get to use a number of languages and have found Python lacks good sound implementation in it's STL. Sure you can download a module, but many organisations make it difficult to install add ons, and when you hand apps to people you don't want to have to say, first install python, then install x, y, z from these websites. The STL needs to have a module added in that handles sound cross platform. I have noticed people are happy with PyGame. Perhaps adding that to the STL would be good for everybody?</p> Chess Notation Player (Python) 2011-05-25T18:41:33-07:00Stijn de Graafhttp://code.activestate.com/recipes/users/4178055/http://code.activestate.com/recipes/577719-chess-notation-player/ <p style="color: grey"> Python recipe 577719 by <a href="/recipes/users/4178055/">Stijn de Graaf</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/chess/">chess</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/notation/">notation</a>, <a href="/recipes/tags/viewer/">viewer</a>). </p> <p>This allows you to input the algebraic chess notation of a game, move by move, and the position of the pieces will be shown on the screen. The upper case letters represent Black pieces and the lower case letters represent White pieces. Most notations are accepted, including Castling and Disambiguating. For details on Algebraic Chess notation see: <a href="http://en.wikipedia.org/wiki/Algebraic_chess_notation." rel="nofollow">http://en.wikipedia.org/wiki/Algebraic_chess_notation.</a></p> SimpleTron3x.py "Game" To DEMO XY Drawing Using The Keyboard In Standard Text Mode Python. (Python) 2011-05-29T14:28:19-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577728-simpletron3xpy-game-to-demo-xy-drawing-using-the-k/ <p style="color: grey"> Python recipe 577728 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/linux/">linux</a>). </p> <p>SimpleTron3x.py.</p> <p>This code is a FUN program only to DEMO how to draw in a text mode Python shell.</p> <p>There is an inkey() "function" extracted from a "class" recipe on this site. See code for more information.</p> <p>This was tested on PCLinuxOS 2009 with Python 3.0.x and Debian 6.0.0 with Python 3.1.x.</p> <p>This ASSUMES an 80 x 24 Python shell window.</p> <p>Issued as Public Domain, you may do as you like with this code.</p> <p>Enjoy finding simple solutions to often very difficult problems.</p> <p>Bazza...</p> monty hall problem (Python) 2010-08-25T20:02:17-07:00markcannolihttp://code.activestate.com/recipes/users/4174766/http://code.activestate.com/recipes/577374-monty-hall-problem/ <p style="color: grey"> Python recipe 577374 by <a href="/recipes/users/4174766/">markcannoli</a> (<a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/statistics/">statistics</a>). </p> <p>Monty_Hall is a gameshow host that proves that it is statistically better to switch when offered the chance after getting additional knowledge in a fair game. The caveat is "statistically better", which means any single trial can have unsupporting results. But "statistically better" is exactly where the fist-fights at bars and family reunions start, so no matter the single trial outcomes.</p> Cryptogram (Python) 2010-04-21T22:09:55-07:00Michael Tobishttp://code.activestate.com/recipes/users/4173740/http://code.activestate.com/recipes/577205-cryptogram/ <p style="color: grey"> Python recipe 577205 by <a href="/recipes/users/4173740/">Michael Tobis</a> (<a href="/recipes/tags/cipher/">cipher</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/maketrans/">maketrans</a>). Revision 2. </p> <p>Some flexible substitution cryptogram encryption/decryption tools and a cipher generator.</p>