pax_global_header00006660000000000000000000000064125705253700014520gustar00rootroot0000000000000052 comment=5037e410fde6fafe8e6bc4cf17a12ad98e01c17e bastet-0.43.2/000077500000000000000000000000001257052537000130705ustar00rootroot00000000000000bastet-0.43.2/.gitignore000066400000000000000000000000321257052537000150530ustar00rootroot00000000000000bastet depend Test *.o *~ bastet-0.43.2/AUTHORS000066400000000000000000000003751257052537000141450ustar00rootroot00000000000000## Coding * Federico Poloni minus 37, github:fph ## Bugfixes and small patches * Markus Wick * Lawrence Gold * Rudolf Polzer ## Repository and packaging * Raphael Robatsch * Salvatore Meschini * David Moreno Garzabastet-0.43.2/BastetBlockChooser.cpp000066400000000000000000000165071257052537000173250ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "BastetBlockChooser.hpp" #include "Block.hpp" #include #include #include //debug #include #include #include #include using namespace std; using namespace boost; namespace Bastet{ long Evaluate(const Well *w, int extralines){ //computes the score for a final position reached in the well + "extralines" lines cleared //high=good for the player //lines long score=100000000*extralines; //adds a bonus for each "free" dot above the occupied blocks profile std::bitset occupied; occupied.reset(); BOOST_FOREACH(WellLine l,w->_well){ occupied = occupied & l; score+=10000*(WellWidth-occupied.count()); } //adds a bonus for lower max height of the occupied blocks int height=RealWellHeight; BOOST_FOREACH(WellLine l, w->_well){ if(l.any()) break; height--; } score+= 1000 * (RealWellHeight-height); return score; } BastetBlockChooser::BastetBlockChooser(){ } BastetBlockChooser::~BastetBlockChooser(){ } Queue BastetBlockChooser::GetStartingQueue(){ Queue q; //The first block is always I,J,L,T (cfr. Tetris guidelines, Bastet is a gentleman and chooses the most favorable start for the user). BlockType first; switch(random()%4){ case 0: first=I;break; case 1: first=J;break; case 2: first=L;break; case 3: first=T;break; } q.push_back(first); q.push_back(BlockType(random()%nBlockTypes)); return q; } boost::array BastetBlockChooser::ComputeMainScores(const Well *well, BlockType currentBlock){ RecursiveVisitor visitor; Searcher(currentBlock,well,BlockPosition(),&visitor); return visitor.GetScores(); } BlockType BastetBlockChooser::GetNext(const Well *well, const Queue &q){ boost::array mainScores=ComputeMainScores(well,q.front()); boost::array finalScores=mainScores; //perturbes scores to randomize tie handling BOOST_FOREACH(long &i, finalScores) i+=(random()%100); //prints the final scores, for debugging convenience for(size_t i=0;i temp(finalScores); sort(temp.begin(),temp.end()); //always returns the worst block if it's different from the last one int worstblock=find(finalScores.begin(),finalScores.end(),temp[0])-finalScores.begin(); if(BlockType(worstblock) != q.front()) return BlockType(worstblock); //otherwise, returns the pos-th block, where pos is random static const boost::array blockPercentages={{80, 92, 98, 100, 100, 100, 100}}; int pos=find_if(blockPercentages.begin(),blockPercentages.end(),bind2nd(greater_equal(),random()%100)) - blockPercentages.begin(); assert(pos>=0 && posVisit(_block,_well,v); } } } BestScoreVisitor::BestScoreVisitor(int bonusLines):_score(GameOverScore),_bonusLines(bonusLines){}; BestScoreVisitor::~BestScoreVisitor(){}; void BestScoreVisitor::Visit(BlockType b, const Well *w, Vertex v){ Well w2(*w); //copy try{ int linescleared=w2.LockAndClearLines(b,v); long thisscore=Evaluate(&w2,linescleared+_bonusLines); _score=max(_score,thisscore); }catch(const GameOver &go){} } RecursiveVisitor::RecursiveVisitor(){_scores.assign(GameOverScore);} RecursiveVisitor::~RecursiveVisitor(){} void RecursiveVisitor::Visit(BlockType b, const Well *w, Vertex v){ Well w2(*w); //copy try{ int linescleared=w2.LockAndClearLines(b,v); //may throw GO for(size_t i=0;i finalScores; for(size_t t=0;t temp(finalScores); sort(temp.begin(),temp.end()); //returns the pos-th block, where pos is random static const boost::array blockPercentages={{80, 92, 98, 100, 100, 100, 100}}; int pos=find_if(blockPercentages.begin(),blockPercentages.end(),bind2nd(greater_equal(),random()%100)) - blockPercentages.begin(); assert(pos>=0 && pos minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef BASTET_BLOCK_CHOOSER_HPP #define BASTET_BLOCK_CHOOSER_HPP #include "BlockChooser.hpp" #include "Well.hpp" #include #include #include namespace Bastet{ static const long GameOverScore=-1000; //bogus score assigned to combinations which cause game over // declared in Well.hpp long Evaluate(const Well *w, int extralines=0); //assigns a score to a position w + a number of extra lines deleted while getting there typedef BlockPosition Vertex; //generic visitor that "does something" with a possible drop position class WellVisitor{ public: WellVisitor(){} virtual void Visit(BlockType b, const Well *well, Vertex v){}; virtual ~WellVisitor(){}; }; //for each block type, drops it (via a BestScoreVisitor) and sees which block reaches the best score along the drop positions class RecursiveVisitor: public WellVisitor{ public: RecursiveVisitor(); virtual ~RecursiveVisitor(); virtual void Visit(BlockType b, const Well *well, Vertex v); const boost::array &GetScores() const{return _scores;} private: typedef boost::array ScoresList; ScoresList _scores; }; //returns the max score over all drop positions class BestScoreVisitor: public WellVisitor{ public: explicit BestScoreVisitor(int bonusLines=0); virtual ~BestScoreVisitor(); virtual void Visit(BlockType b, const Well *well, Vertex v); long GetScore() const{return _score;} private: long _score; int _bonusLines; }; /** * Tries to drop a block in all possible positions, and invokes the visitor on each one */ class Searcher{ public: Searcher(BlockType b, const Well *well, Vertex v, WellVisitor *visitor); private: std::tr1::unordered_set _visited; //std::set _visited; ^^ the above is more efficient, we need to do many inserts BlockType _block; const Well *_well; WellVisitor *_visitor; void DFSVisit(Vertex v); }; class BastetBlockChooser: public BlockChooser{ public: BastetBlockChooser(); virtual ~BastetBlockChooser(); virtual Queue GetStartingQueue(); virtual BlockType GetNext(const Well *well, const Queue &q); /** * computes "scores" of the candidate next blocks by dropping them in all possible positions and choosing the one that has the least max_(drop positions) Evaluate(well) */ boost::array ComputeMainScores(const Well *well, BlockType currentBlock); private: }; //block chooser similar to the older bastet versions, does not give a block preview class NoPreviewBlockChooser:public BlockChooser{ public: NoPreviewBlockChooser(); virtual ~NoPreviewBlockChooser(); virtual Queue GetStartingQueue(); virtual BlockType GetNext(const Well *well, const Queue &q); }; } #endif //BASTET_BLOCK_CHOOSER_HPP bastet-0.43.2/Block.cpp000066400000000000000000000066671257052537000146450ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "Block.hpp" #include "curses.h" namespace Bastet{ BlockArray blocks={{ BlockImpl(COLOR_PAIR(7),(OrientationMatrix){{ //O //should be yellow, but I find no portable way to output a yellow solid block character in ncurses. {{//orientation 0 (initial {1,1},{2,1},{1,0},{2,0} }}, {{//orientation 1 {1,1},{2,1},{1,0},{2,0} }}, {{//orientation 2 {1,1},{2,1},{1,0},{2,0} }}, {{//orientation 3 {1,1},{2,1},{1,0},{2,0} }} }}), BlockImpl(COLOR_PAIR(4),(OrientationMatrix){{ //I {{//orientation 0 (initial) {0,1},{1,1},{2,1},{3,1} }}, {{//orientation 1 {2,3},{2,1},{2,2},{2,0} }}, {{//orientation 2 {0,2},{1,2},{2,2},{3,2} }}, {{//orientation 3 {1,3},{1,1},{1,2},{1,0} }} }}), BlockImpl(COLOR_PAIR(1),(OrientationMatrix){{ //Z {{//orientation 0 (initial {1,1},{2,1},{0,0},{1,0} }}, {{//orientation 1 {1,2},{1,1},{2,1},{2,0} }}, {{//orientation 2 {1,2},{2,2},{0,1},{1,1} }}, {{//orientation 3 {0,2},{0,1},{1,1},{1,0} }} }}), BlockImpl(COLOR_PAIR(5),(OrientationMatrix){{ //T {{//orientation 0 (initial {0,1},{1,1},{2,1},{1,0} }}, {{//orientation 1 {1,2},{1,1},{2,1},{1,0} }}, {{//orientation 2 {1,2},{0,1},{1,1},{2,1} }}, {{//orientation 3 {1,2},{0,1},{1,1},{1,0} }} }}), BlockImpl(COLOR_PAIR(6),(OrientationMatrix){{ //J {{//orientation 0 (initial {0,1},{1,1},{2,1},{0,0} }}, {{//orientation 1 {1,2},{1,1},{1,0},{2,0} }}, {{//orientation 2 {2,2},{0,1},{1,1},{2,1} }}, {{//orientation 3 {0,2},{1,2},{1,1},{1,0} }} }}), BlockImpl(COLOR_PAIR(3),(OrientationMatrix){{ //S {{//orientation 0 (initial {0,1},{1,1},{1,0},{2,0} }}, {{//orientation 1 {2,2},{1,1},{2,1},{1,0} }}, {{//orientation 2 {0,2},{1,2},{1,1},{2,1} }}, {{//orientation 3 {1,2},{0,1},{1,1},{0,0} }} }}), BlockImpl(COLOR_PAIR(2),(OrientationMatrix){{ //L {{//orientation 0 (initial {0,1},{1,1},{2,1},{2,0} }}, {{//orientation 1 {1,2},{2,2},{1,1},{1,0} }}, {{//orientation 2 {0,2},{0,1},{1,1},{2,1} }}, {{//orientation 3 {1,2},{1,1},{0,0},{1,0} }} }}) }}; // const DotMatrix GetDots(BlockType b, Dot position, Orientation o){ // return blocks[b].GetDots(position,o); // } const Color GetColor(BlockType b){ return blocks[b].GetColor(); } const char GetChar(BlockType b){ return "OIZTJSL"[int(b)]; } size_t hash_value(const Dot &d){ return (d.x+5)*32+d.y; } } bastet-0.43.2/Block.hpp000066400000000000000000000062661257052537000146450ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef BLOCK_HPP #define BLOCK_HPP #include #include namespace Bastet{ static const int WellHeight=20; static const int WellWidth=10; static const int RealWellHeight=WellHeight+2; typedef int Color; //to be given to wattrset class Orientation{ public: Orientation(unsigned char o=0):_o(o){} operator unsigned char() const{ return _o; } Orientation operator++(){ return (++_o & 3); } Orientation Next() const{ return ((_o+1) & 3); } Orientation operator--(){ return (--_o & 3); } Orientation Prior() const{ return((_o-1) & 3); } const static size_t Number=4; private: unsigned char _o; }; enum BlockType{ O=0, I=1, Z=2, T=3, J=4, S=5, L=6 }; const size_t nBlockTypes=7; struct Dot; typedef boost::array DotMatrix; //the four dots occupied by a tetromino typedef boost::array OrientationMatrix; //the four orientations of a tetromino struct Dot{ int x; int y; bool IsValid() const{ return (y>=-2) && y=0) && (x BlockArray; extern BlockArray blocks; //should be members, but BlockType is an enum... // const DotMatrix GetDots(BlockType b, Dot position, Orientation o); const Color GetColor(BlockType b); const char GetChar(BlockType b); } #endif //BLOCK_HPP bastet-0.43.2/BlockChooser.cpp000066400000000000000000000025001257052537000161460ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "BlockChooser.hpp" #include //random namespace Bastet{ BlockChooser::BlockChooser(){} BlockChooser::~BlockChooser(){} RandomBlockChooser::RandomBlockChooser(){} RandomBlockChooser::~RandomBlockChooser(){} Queue RandomBlockChooser::GetStartingQueue(){ Queue q; q.push_back(BlockType(random()%nBlockTypes)); q.push_back(BlockType(random()%nBlockTypes)); return q; } BlockType RandomBlockChooser::GetNext(const Well *well, const Queue &q){ return BlockType(random()%nBlockTypes); } } bastet-0.43.2/BlockChooser.hpp000066400000000000000000000032011257052537000161520ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef BLOCKCHOOSER_HPP #define BLOCKCHOOSER_HPP #include "Block.hpp" #include namespace Bastet{ class Well; //queue of blocks to appear on the screen typedef std::deque Queue; ///Abstract class to represent a block choosing algorithm class BlockChooser{ public: BlockChooser(); virtual ~BlockChooser(); virtual Queue GetStartingQueue()=0; //chooses first blocks after a game starts virtual BlockType GetNext(const Well *well, const Queue &q)=0; //chooses next block private: }; ///the usual Tetris random block chooser, for testing purposes class RandomBlockChooser: public BlockChooser{ public: RandomBlockChooser(); virtual ~RandomBlockChooser(); virtual Queue GetStartingQueue(); virtual BlockType GetNext(const Well *well, const Queue &q); private: }; } #endif //BLOCKCHOOSER_HPP bastet-0.43.2/BlockPosition.cpp000066400000000000000000000037351257052537000163630ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "BlockPosition.hpp" #include "Block.hpp" #include "Well.hpp" #include "boost/foreach.hpp" namespace Bastet{ const DotMatrix BlockPosition::GetDots(BlockType b) const{ return _pos+((blocks[b].GetOrientationMatrix())[_orientation]); } void BlockPosition::Move(Movement m){ switch(m){ case RotateCW: _orientation=_orientation.Next(); break; case RotateCCW: _orientation=_orientation.Prior(); break; case Left: _pos.x-=1; break; case Right: _pos.x+=1; break; case Down: _pos.y+=1; break; } } bool BlockPosition::MoveIfPossible(Movement m, BlockType b, const Well *w){ BlockPosition p(*this); p.Move(m); if (p.IsValid(b,w)){ *this=p; return true; } else return false; } bool BlockPosition::IsValid(BlockType bt, const Well *w) const{ return w->Accomodates(GetDots(bt)); //XX: must change, unoptimized } void BlockPosition::Drop(BlockType bt, const Well *w){ while(MoveIfPossible(Down,bt,w)); } bool BlockPosition::IsOutOfScreen(BlockType bt) const{ BOOST_FOREACH(const Dot &d, GetDots(bt)){ if(d.y>=0) return false; } return true; } } bastet-0.43.2/BlockPosition.hpp000066400000000000000000000036071257052537000163660ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef BLOCK_POSITION_HPP #define BLOCK_POSITION_HPP #include "Block.hpp" namespace Bastet{ /** Block position = position (x,y) + orientation -- this is the object that gets evaluated by the block chooser */ class Well; enum Movement {RotateCW,RotateCCW,Left,Right,Down}; class BlockPosition{ private: Dot _pos; Orientation _orientation; public: BlockPosition(Dot d=(Dot){3,-2}, Orientation o=Orientation()):_pos(d),_orientation(o){}; bool operator==(const BlockPosition &p) const{ return _pos==p._pos && _orientation==p._orientation; } ///returns an y such that the block lies completely in [y,y+3] int GetBaseY() const{return _pos.y;} void Move(Movement m); bool MoveIfPossible(Movement m, BlockType b, const Well *w); void Drop(BlockType bt, const Well *w); const DotMatrix GetDots(BlockType b) const; bool IsValid(BlockType bt, const Well *w) const; bool IsOutOfScreen(BlockType bt) const; friend size_t hash_value(const BlockPosition &p){ return hash_value(p._pos)*4+int(p._orientation); } }; } #endif //BLOCK_POSITION_HPP bastet-0.43.2/Config.cpp000066400000000000000000000157441257052537000150140ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "Config.hpp" #include #include #include #include #include #include #include #include //DBG #include using namespace std; using namespace boost; namespace po=boost::program_options; namespace Bastet{ const size_t HowManyHighScores=10; const std::string RcFileName="/.bastetrc"; const std::string LocalHighScoresFileName="/.bastetscores"; const std::string GlobalHighScoresFileName="/var/games/bastet.scores2"; bool HighScores::Qualifies(int score){ stable_sort(begin(),end()); return begin()->Score < score; } int HighScores::InsertHighScore(int score, const std::string &scorer){ if(!Qualifies(score)) return -1; HighScore hs={score,scorer}; insert(begin(),hs); //we insert at the beginning to resolve ties stable_sort(begin(),end()); //the dumbest way to do it erase(begin()); iterator it=find(begin(),end(),hs); //the dumbest way to find the position return end()-it+1; } Config config; //singleton instance std::string Config::GetConfigFileName() const{ return string(getenv("HOME"))+RcFileName; } class CannotOpenFile{}; std::string Config::GetHighScoresFileName() const{ static std::string result; //gets cached if(!result.empty()) return result; //tries the global one first and sees if it's writable fstream ofs(GlobalHighScoresFileName.c_str()); if(!ofs.fail()){ result=GlobalHighScoresFileName; } ofs.close(); //falls back to the user-specific file string s=string(getenv("HOME"))+LocalHighScoresFileName; if(result.empty()){ cerr<()->default_value(KEY_DOWN),"Down key") ("Left",po::value()->default_value(KEY_LEFT),"Left key") ("Right",po::value()->default_value(KEY_RIGHT),"Right key") ("RotateCW",po::value()->default_value(' '),"Clockwise turn key") ("RotateCCW",po::value()->default_value(KEY_UP),"Counterclockwise turn key") ("Drop",po::value()->default_value(KEY_ENTER),"Drop tetromino key") ("Pause",po::value()->default_value('p'),"Pause key") ; po::options_description highScoresOpts("High scores"); boost::format scorer("Scorer%02d%02d"); boost::format score("Score%02d%02d"); for(int difficulty=0;difficulty()->default_value("No one played yet"),"Name of high scorer") (str(score % difficulty % i).c_str(),po::value()->default_value(0),"High score (points)") ; } boost::program_options::variables_map _options; boost::program_options::variables_map _highScores; ifstream ifs(GetConfigFileName().c_str()); po::store(po::parse_config_file(ifs,keyMappingOpts),_options); _keys.Down=_options["Down"].as(); _keys.Left=_options["Left"].as(); _keys.Right=_options["Right"].as(); _keys.RotateCW=_options["RotateCW"].as(); _keys.RotateCCW=_options["RotateCCW"].as(); _keys.Drop=_options["Drop"].as(); _keys.Pause=_options["Pause"].as(); string s=GetHighScoresFileName(); ifstream ifs2(s.c_str()); po::store(po::parse_config_file(ifs2,highScoresOpts),_highScores); for(int difficulty=0;difficulty(), _highScores[str(scorer % difficulty % i)].as()}); stable_sort(_hs[difficulty].begin(),_hs[difficulty].end()); //should not be needed but... } } Keys *Config::GetKeys(){ return &_keys; } HighScores *Config::GetHighScores(int difficulty){ assert(difficulty>=0 && difficulty minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef CONFIG_HPP #define CONFIG_HPP #include #include #include namespace Bastet{ struct Keys{ int Down; int Left; int Right; int RotateCW; int RotateCCW; int Drop; int Pause; }; struct HighScore{ int Score; std::string Scorer; bool operator < (const HighScore &b) const{ return Score{ //a set would not do the right job (think to ties) public: bool Qualifies(int score); int InsertHighScore(int score, const std::string &scorer); //returns position (1 to HowManyHighScores), -1 if you don't make into the list }; extern const std::string RcFileName; extern const std::string LocalHighScoresFileName; extern const std::string GlobalHighScoresFileName; class Config{ private: Keys _keys; boost::array _hs; public: Config(); ~Config(); Keys *GetKeys(); HighScores *GetHighScores(int difficulty); std::string GetConfigFileName() const; std::string GetHighScoresFileName() const; }; extern Config config; //singleton } #endif //CONFIG_HPP bastet-0.43.2/INSTALL000066400000000000000000000012751257052537000141260ustar00rootroot00000000000000==Prerequisites== Boost (libboost-dev + libboost-program-options-dev), ncurses (libncurses-dev). "make" creates an executable file called "bastet", that's all you need to run the program. Optionally, for system-wide high scores, you may want to create an empty "/var/games/bastet.scores2" file, and make sure that is writable to the bastet executable. Simplest way to create system-wide high scores under any Linux distro that has a "games" groups: cd the-directory-in-which-you-found-this-file make cp bastet /usr/local/bin chgrp games /usr/local/bin/bastet chmod g+s /usr/local/bin/bastet touch /var/games/bastet.scores2 chgrp games /var/games/bastet.scores2 chmod 664 /var/games/bastet.scores2 bastet-0.43.2/LICENSE000066400000000000000000001045131257052537000141010ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . bastet-0.43.2/Makefile000066400000000000000000000014201257052537000145250ustar00rootroot00000000000000SOURCES=Ui.cpp Block.cpp Well.cpp BlockPosition.cpp Config.cpp BlockChooser.cpp BastetBlockChooser.cpp MAIN=main.cpp TESTS=Test.cpp PROGNAME=bastet BOOST_PO?=-lboost_program_options LDFLAGS+=-lncurses $(BOOST_PO) #CXXFLAGS+=-ggdb -Wall CXXFLAGS+=-DNDEBUG -Wall #CXXFLAGS+=-pg #LDFLAGS+=-pg all: $(PROGNAME) $(TESTS:.cpp=) Test: $(SOURCES:.cpp=.o) $(TESTS:.cpp=.o) $(CXX) -ggdb -o $(TESTS:.cpp=) $(SOURCES:.cpp=.o) $(TESTS:.cpp=.o) $(LDFLAGS) depend: *.hpp $(SOURCES) $(MAIN) $(TESTS) $(CXX) -MM $(SOURCES) $(MAIN) $(TESTS)> depend include depend $(PROGNAME): $(SOURCES:.cpp=.o) $(MAIN:.cpp=.o) $(CXX) -ggdb -o $(PROGNAME) $(SOURCES:.cpp=.o) $(MAIN:.cpp=.o) $(LDFLAGS) clean: rm -f $(SOURCES:.cpp=.o) $(TESTS:.cpp=.o) $(MAIN:.cpp=.o) $(PROGNAME) mrproper: clean rm -f *~ bastet-0.43.2/NEWS000066400000000000000000000034671257052537000136010ustar00rootroot00000000000000==0.43.1== Small fixes: appdata and desktop file, moved to an unordered_set header that should work on most compilers. Should still port to autotools or something similar sometimes in the future. ==0.43== Complete code rewrite. As I go on trying to grok C++, algorithms and data structures, and as I started to understand more of Peter's code, I found it useful to rewrite all this stuff from scratch. This should solve some issues and probably introduce new ones. Therefore this version needs a lot of playtesting and bug-hunting. The algorithm has been split into two, one with the next block preview (normal) and one without (harder). New and more sophisticated techniques are now used to write the block-choosing algorithms, which should not be fooled as easily as before. ==0.41== Features a brand-new AI, which should provide a much less boring gameplay and avoid some bugs of the previous one. I have not done any work on the interface since my primary goal is having a good algorithm, and not the eye-candy. This new version somehow avoids the endless queues of the same block you saw in 0.37: unfortunately, this makes the game a bit easier (now you can do five lines with much less effort). If you do not like the thing, you can tweak the figures at the bottom of bast.c, which should look like this: const int bl_percent[BLOCK_TYPES]={75,92,98,100,100,100,100}; that is: 75% chance you will get the worst brick, 92-75% for the second one and so on (no chance to get the best three bricks). Editing to 85,95,100,100,100,100,100 will considerably increase the difficulty of the game (TODO: some better way to choose this...). Moreover, the old 0.37 algorithm can be compiled in (instead of the new one) by simply renaming bast-old.c to bast.c ==0.37== First public release, created by modifying Petris by Peter Seidler. bastet-0.43.2/README000066400000000000000000000027741257052537000137620ustar00rootroot00000000000000"For people who enjoy swearing at their computer, Bastet (short for Bastard Tetris) is an attractive alternative to Microsoft Word." Have you ever thought Tetris(R) was evil because it wouldn't send you that straight "I" brick you needed in order to clear four rows at the same time? Well Tetris(R) probably isn't evil, but Bastet certainly is. >:-) Bastet stands for "bastard tetris", and is a simple ncurses-based Tetris(R) clone for Linux. Unlike normal Tetris(R), however, Bastet does not choose your next brick at random. Instead, Bastet uses a special algorithm designed to choose the worst brick possible. As you can imagine, playing Bastet can be a very frustrating experience! ==Instructions== The game is pretty self-explanatory; use the arrow keys and or to browse through the menus, set the keys to anything you're comfortable with, and hit "Play!". The default keys are as follows: Down Down Left Left Right Right Space bar Rotate tetromino clockwise Up Rotate tetromino counterclockwise Enter "Hard-drop" tetromino (like pressing "Down" continuously) p Pause control+C Quits the game immediately and without asking anything (the current game is lost, but previous games are recorded in the high scores file) ==Normal/Harder== The game currently allows choosing between two block choosers. The second (harder) one does not show you the "next block" preview, thus achieving a higher level of bastardness. ==Installation== See the INSTALL file in this same directory. bastet-0.43.2/Test.cpp000066400000000000000000000006621257052537000145170ustar00rootroot00000000000000#include "Well.hpp" #include "BastetBlockChooser.hpp" #include using namespace Bastet; using namespace std; int main(){ Well *w=new Well; BlockPosition p; p.Drop(Z,w); w->LockAndClearLines(Z,p); cout<PrettyPrint()<Clear(); BlockPosition p2; p2.Drop(I,w); w->LockAndClearLines(I,p2); cout<PrettyPrint()< minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "Ui.hpp" #include "BlockPosition.hpp" #include "Config.hpp" #include "BastetBlockChooser.hpp" #include "BlockChooser.hpp" #include #include #include #include #include using namespace std; using namespace boost; namespace Bastet{ Score &operator +=(Score &a, const Score &b){ a.first+=b.first; a.second+=b.second; return a; } void voidendwin(){ endwin(); } void PrepareUiGetch(){ ///gets ready for a getch() in the UI, i.e. empties the char buffer, sets blocking IO nodelay(stdscr,TRUE); while(getch()!=ERR); nodelay(stdscr,FALSE); } BorderedWindow::BorderedWindow(int height, int width, int y, int x){ if(y==-1 || x==-1){ int screen_h, screen_w; getmaxyx(stdscr,screen_h, screen_w); if(y==-1) y=(screen_h-height-2)/2-1; if(x==-1) x=(screen_w-width-2)/2-1; } _border=newwin(height+2,width+2,y,x); _window=derwin(_border,height,width,1,1); // wattrset(_border,COLOR_PAIR(21)); RedrawBorder(); } BorderedWindow::~BorderedWindow(){ delwin(_window); delwin(_border); } BorderedWindow::operator WINDOW*(){ return _window; } void BorderedWindow::RedrawBorder(){ box(_border,0,0); wrefresh(_border); } int BorderedWindow::GetMinX(){ int x, y; getbegyx(_border,y,x); (void)(y); //silence warning about unused y return x; } int BorderedWindow::GetMinY(){ int y, x; getbegyx(_border,y,x); return y; } int BorderedWindow::GetMaxX(){ int x, y; getmaxyx(_border,y,x); (void)(y); //silence warning about unused y return GetMinX()+x; } int BorderedWindow::GetMaxY(){ int y,x; getmaxyx(_border,y,x); return GetMinY()+y; } void BorderedWindow::DrawDot(const Dot &d, Color c){ wattrset((WINDOW *)(*this),c); mvwaddch(*this,d.y,2*d.x,' '); mvwaddch(*this,d.y,2*d.x+1,' '); } Curses::Curses(){ if(initscr()==NULL){ fprintf(stderr,"bastet: error while initializing graphics (ncurses library).\n"); exit(1); } if(!has_colors()){ endwin(); fprintf(stderr,"bastet: no color support, sorry. Ask the author for a black and white version."); exit(1); } /* Turn off cursor. */ curs_set(0); atexit(voidendwin); /*make sure curses are properly stopped*/ /* Setup keyboard. We'd like to get each and every character, but not to display them on the terminal. */ keypad(stdscr, TRUE); nodelay(stdscr, TRUE); nonl(); noecho(); cbreak(); start_color(); /* 1 - 16 is for blocks */ init_pair(1, COLOR_BLACK, COLOR_RED); init_pair(2, COLOR_BLACK, COLOR_YELLOW); init_pair(3, COLOR_BLACK, COLOR_GREEN); init_pair(4, COLOR_BLACK, COLOR_CYAN); init_pair(5, COLOR_BLACK, COLOR_MAGENTA); init_pair(6, COLOR_BLACK, COLOR_BLUE); init_pair(7, COLOR_BLACK, COLOR_WHITE); /* 17 - ? is for other things */ init_pair(17, COLOR_RED, COLOR_BLACK); //points init_pair(18, COLOR_YELLOW, COLOR_BLACK); //number of lines init_pair(19, COLOR_GREEN, COLOR_BLACK); //level init_pair(20, COLOR_YELLOW, COLOR_BLACK); //messages init_pair(21, COLOR_WHITE, COLOR_BLACK); //window borders init_pair(22, COLOR_WHITE, COLOR_BLACK); //end of line animation /* Set random seed. */ srandom(time(NULL)+37); } Ui::Ui(): _level(0), _wellWin(WellHeight,2*WellWidth), _nextWin(5,14,_wellWin.GetMinY(),_wellWin.GetMaxX()+1), _scoreWin(7,14,_nextWin.GetMaxY(),_nextWin.GetMinX()) { BOOST_FOREACH(ColorWellLine &a, _colors) a.assign(0); } Dot BoundingRect(const std::string &message){ //returns x and y of the minimal rectangle containing the given string vector splits; split(splits,message,is_any_of("\n")); size_t maxlen=0; BOOST_FOREACH(string &s, splits){ maxlen=max(maxlen,s.size()); } return (Dot){int(maxlen+1),int(splits.size())}; } void Ui::MessageDialog(const std::string &message){ RedrawStatic(); Dot d=BoundingRect(message); BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); mvwprintw(w,0,0,message.c_str()); w.RedrawBorder(); wrefresh(w); PrepareUiGetch(); int ch; do{ ch=getch(); } while(ch!=' ' && ch!=13); //13=return key!=KEY_ENTER, it seems } std::string Ui::InputDialog(const std::string &message){ RedrawStatic(); Dot d=BoundingRect(message); d.y+=3; BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); mvwprintw(w,0,0,message.c_str()); w.RedrawBorder(); wrefresh(w); PrepareUiGetch(); //nocbreak(); echo(); curs_set(1); char buf[51]; mvwgetnstr(w,d.y-2,1,buf,50); curs_set(0); noecho(); return string(buf); } int Ui::KeyDialog(const std::string &message){ RedrawStatic(); Dot d=BoundingRect(message); BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); mvwprintw(w,0,0,message.c_str()); w.RedrawBorder(); wrefresh(w); PrepareUiGetch(); return getch(); } int Ui::MenuDialog(const vector &choices){ RedrawStatic(); size_t width=0; BOOST_FOREACH(const string &s, choices){ width=max(width,s.size()); } Dot d={int(width+5),int(choices.size())}; BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); for(size_t i=0;i "); wrefresh(w); do{ ch=getch(); switch(ch){ case KEY_UP: if(chosen==0) break; mvwprintw(w,chosen,1," "); chosen--; mvwprintw(w,chosen,1,"-> "); wrefresh(w); break; case KEY_DOWN: if(chosen==choices.size()-1) break; mvwprintw(w,chosen,1," "); chosen++; mvwprintw(w,chosen,1,"-> "); wrefresh(w); break; case 13: //ENTER case ' ': done=true; break; } } while(!done); return chosen; } void Ui::ChooseLevel(){ RedrawStatic(); int ch='0'; format fmt(" Get ready!\n" " \n" " Starting level = %1% \n" " 0-9 to change\n" " to start\n"); string msg; while(ch!=' '){ msg=str(fmt % _level); PrepareUiGetch(); Dot d=BoundingRect(msg ); BorderedWindow w(d.y,d.x); wattrset((WINDOW *)w,COLOR_PAIR(20)); mvwprintw(w,0,0,msg.c_str()); w.RedrawBorder(); ch=getch(); switch(ch){ case '0'...'9': _level=ch-'0'; } } assert(_level>=0 && _level<=9); } void Ui::RedrawStatic(){ erase(); wrefresh(stdscr); _wellWin.RedrawBorder(); _nextWin.RedrawBorder(); _scoreWin.RedrawBorder(); wattrset((WINDOW*)_nextWin,COLOR_PAIR(17)); mvwprintw(_nextWin,0,0," Next block:"); wrefresh(_nextWin); wattrset((WINDOW*)_scoreWin,COLOR_PAIR(17)); mvwprintw(_scoreWin,1,0,"Score:"); wattrset((WINDOW*)_scoreWin,COLOR_PAIR(18)); mvwprintw(_scoreWin,3,0,"Lines:"); wattrset((WINDOW*)_scoreWin,COLOR_PAIR(19)); mvwprintw(_scoreWin,5,0,"Level:"); wrefresh(_scoreWin); } //must be <1E+06, because it should fit into a timeval usec field(see man select) static const boost::array delay = {{999999, 770000, 593000, 457000, 352000, 271000, 208000, 160000, 124000, 95000}}; void Ui::DropBlock(BlockType b, Well *w){ fd_set in, tmp_in; struct timeval time; FD_ZERO(&in); FD_SET(0,&in); //adds stdin time.tv_sec=0; time.tv_usec=delay[_level]; //assumes nodelay(stdscr,TRUE) has already been called BlockPosition p; RedrawWell(w,b,p); Keys *keys=config.GetKeys(); while(1){ //break = tetromino locked tmp_in=in; int sel_ret=select(FD_SETSIZE,&tmp_in, NULL, NULL, &time); if(sel_ret==0){ //timeout if(!p.MoveIfPossible(Down,b,w)) break; time.tv_sec=0; time.tv_usec=delay[_level]; } else{ //keypress int ch=getch(); if(ch==keys->Left) p.MoveIfPossible(Left,b,w); else if(ch==keys->Right) p.MoveIfPossible(Right,b,w); else if(ch==keys->Down){ bool val=p.MoveIfPossible(Down,b,w); if(val){ //_points++; //RedrawScore(); time.tv_sec=0; time.tv_usec=delay[_level]; } else break; } else if(ch==keys->RotateCW) p.MoveIfPossible(RotateCW,b,w); else if(ch==keys->RotateCCW) p.MoveIfPossible(RotateCCW,b,w); else if(ch==keys->Drop){ p.Drop(b,w); //_points+=2*fb.HardDrop(w); //RedrawScore(); break; } else if(ch==keys->Pause){ MessageDialog("Press SPACE or ENTER to resume the game"); RedrawStatic(); RedrawWell(w,b,p); nodelay(stdscr,TRUE); } else {} //default... } //keypress switch RedrawWell(w,b,p); } //while(1) LinesCompleted lc=w->Lock(b,p); //locks also into _colors BOOST_FOREACH(const Dot &d, p.GetDots(b)) if(d.y>=0) _colors[d.y+2][d.x]=GetColor(b); RedrawWell(w,b,p); if(lc._completed.any()){ CompletedLinesAnimation(lc); w->ClearLines(lc); //clears also _colors ColorWell::reverse_iterator it=lc.Clear(_colors.rbegin(),_colors.rend()); for(;it!=_colors.rend();++it){ it->assign(0); } int newlines=lc._completed.count(); if(( (_lines+newlines)/10 - _lines/10 !=0) && _level<9){ _level++; } _lines+=newlines; switch(newlines){ case 1: _points+=100; break; case 2: _points+=300; break; case 3: _points+=500; break; case 4: _points+=800; break; } RedrawScore(); } } void Ui::RedrawWell(const Well *w, BlockType b, const BlockPosition &p){ for(int i=0;iGetStartingQueue(); if(q.size()==1) //no block preview ClearNext(); try{ while(true){ while(getch()!=ERR); //ignores the keys pressed during the next block calculation BlockType current=q.front(); q.pop_front(); if(!q.empty()) RedrawNext(q.front()); DropBlock(current,&w); q.push_back(bc->GetNext(&w,q)); } } catch(GameOver &go){ } return; } void Ui::HandleHighScores(difficulty_t diff){ HighScores *hs=config.GetHighScores(diff); if(hs->Qualifies(_points)){ string name=InputDialog(" Congratulations! You got a high score \n Please enter your name"); hs->InsertHighScore(_points,name); }else{ MessageDialog("You did not get into\n" "the high score list!\n" "\n" " Try again!\n" ); } } void Ui::ShowHighScores(difficulty_t diff){ HighScores *hs=config.GetHighScores(diff); string allscores; if(diff==difficulty_normal) allscores+="**Normal difficulty**\n"; else if(diff==difficulty_hard) allscores+="**Hard difficulty**\n"; format fmt("%-20.20s %8d\n"); for(HighScores::reverse_iterator it=hs->rbegin();it!=hs->rend();++it){ allscores+=str(fmt % it->Scorer % it->Score); } MessageDialog(allscores); } void Ui::CustomizeKeys(){ Keys *keys=config.GetKeys(); format fmt( "Press the key you wish to use for:\n\n" "%=1.34s\n\n"); keys->Down=KeyDialog(str(fmt % "move tetromino DOWN (soft-drop)")); keys->Left=KeyDialog(str(fmt % "move tetromino LEFT")); keys->Right=KeyDialog(str(fmt % "move tetromino RIGHT")); keys->RotateCW=KeyDialog(str(fmt % "rotate tetromino CLOCKWISE")); keys->RotateCCW=KeyDialog(str(fmt % "rotate tetromino COUNTERCLOCKWISE")); keys->Drop=KeyDialog(str(fmt % "DROP tetromino (move down as much as possible immediately)")); keys->Pause=KeyDialog(str(fmt % "PAUSE the game")); } } bastet-0.43.2/Ui.hpp000066400000000000000000000061321257052537000141600ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef UI_HPP #define UI_HPP #include "Well.hpp" #include "BlockPosition.hpp" #include "BlockChooser.hpp" #include "Config.hpp" #include #include namespace Bastet{ typedef std::pair Score; //(points, lines) Score &operator +=(Score &a, const Score &b); class BorderedWindow{ private: WINDOW *_window; WINDOW *_border; public: BorderedWindow(int height, int width, int y=-1, int x=-1); ///w and h are "inner" dimensions, excluding the border. y and x are "outer", including the border. y=-1,x=-1 means "center" ~BorderedWindow(); operator WINDOW *(); //returns the inner window void RedrawBorder(); int GetMinX(); ///these are including border int GetMinY(); int GetMaxX(); int GetMaxY(); void DrawDot(const Dot &d, Color c); }; class Curses{ public: Curses(); }; class Ui{ public: Ui(); void MessageDialog(const std::string &message); //shows msg, ask for "space" std::string InputDialog(const std::string &message); //asks for a string int KeyDialog(const std::string &message); //asks for a single key int MenuDialog(const std::vector &choices); //asks to choose one, returns index void RedrawStatic(); //redraws the "static" parts of the screen void RedrawWell(const Well *well, BlockType falling, const BlockPosition &pos); void ClearNext(); //clear the next block display void RedrawNext(BlockType next); //redraws the next block display void RedrawScore(); void CompletedLinesAnimation(const LinesCompleted &completed); void DropBlock(BlockType b, Well *w); //returns void ChooseLevel(); void Play(BlockChooser *bc); void HandleHighScores(difficulty_t diff); ///if needed, asks name for highscores void ShowHighScores(difficulty_t diff); void CustomizeKeys(); private: // difficulty_t _difficulty; //unused for now int _level; int _points; int _lines; Curses _curses; BorderedWindow _wellWin; BorderedWindow _nextWin; BorderedWindow _scoreWin; /** * this is a kind of "well" structure to store the colors used to draw the blocks. */ typedef boost::array ColorWellLine; typedef boost::array ColorWell; ColorWell _colors; }; } #endif //UI_HPP bastet-0.43.2/Well.cpp000066400000000000000000000051401257052537000144770ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "Well.hpp" #include #include #include #include namespace Bastet{ std::string WellLine::PrettyPrint() const{ std::string s; s.reserve(this->size()); for(unsigned int i=0;isize();++i) s.push_back(operator[](i)?'#':' '); return s; } Well::Well(){ Clear(); } Well::~Well(){ } void Well::Clear(){ BOOST_FOREACH(WellLine &l, _well){ l.reset(); } } bool Well::Accomodates(const DotMatrix &m) const{ BOOST_FOREACH(const Dot &d, m){ if(!d.IsValid() || _well[d.y+2][d.x]==true) return false; } return true; } bool Well::IsLineComplete(int y) const{ for(int x=0;x<(int)WellWidth;++x) if(_well[y+2][x]==false) return false; return true; } LinesCompleted Well::Lock(BlockType t, const BlockPosition &p){ if(p.IsOutOfScreen(t)) throw(GameOver()); BOOST_FOREACH(const Dot &d,p.GetDots(t)){ _well[d.y+2][d.x]=true; } //checks for completedness LinesCompleted lc; lc._baseY=p.GetBaseY(); for(int k=0;k<4;++k){ int l=lc._baseY+k; if(IsValidLine(l) && IsLineComplete(l)) lc._completed[k]=true; } return lc; } void Well::ClearLines(const LinesCompleted &completed){ WellType::reverse_iterator it=completed.Clear(_well.rbegin(),_well.rend()); for(;it!=_well.rend();++it){ it->reset(); } } int Well::LockAndClearLines(BlockType t, const BlockPosition &p){ LinesCompleted lc=Lock(t,p); ClearLines(lc); return lc._completed.count(); } std::string Well::PrettyPrint() const{ std::ostringstream str; str< minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef WELL_HPP #define WELL_HPP #include "Block.hpp" //for Color #include "BlockPosition.hpp" #include //size_t #include #include #include //DBG #include namespace Bastet{ class GameOver{}; //used as an exception class WellLine: public std::bitset{ public: std::string PrettyPrint() const; }; ///complex type that holds which lines are completed ///if _completed[k]==true, then line _baseY+k exists and is completed class LinesCompleted{ public: int _baseY; std::bitset<4> _completed; ///clear, returns iterator such that the segment [it, rend) is "new" (to be zeroed out by hand) template Iterator Clear(Iterator rbegin, Iterator rend) const; }; /* * the real height of the well is _height+2, with the top two rows( -1 and -2) hidden (see guidelines) */ class Well{ private: typedef boost::array WellType; WellType _well; public: Well(); ~Well(); void Clear(); bool Accomodates(const DotMatrix &d) const; //true if the given tetromino fits into the well bool IsValidLine(int y) const{return (y>=-2) && (y Iterator LinesCompleted::Clear(Iterator rbegin, Iterator rend) const{ if(_completed.none()) return rend; Iterator orig=rbegin; Iterator dest=rbegin; int j=WellHeight-1; while(orig=0 && j-_baseY<4 && _completed[j-_baseY]){ //skip } else{ *dest=*orig; dest++; } j--; orig++; } return dest++; } } #endif //WELL_HPP bastet-0.43.2/bastet.6000066400000000000000000000025411257052537000144430ustar00rootroot00000000000000.TH BASTET 6 "FEBRUARY 2009" .SH NAME bastet \- Tetris(r) clone with "bastard" block-choosing AI .SH SYNOPSIS .B bastet .SH DESCRIPTION .B bastet (short for "bastard tetris") is a Tetris(r) clone which tries to give you the worst possible block. Playing bastet can be a painful experience, especially if you usually make "canyons" and wait for the long I-shaped block. .SH USAGE .B bastet tries to conform as much as possible to the tetris guidelines. We refer to those for the rules of the game. In the starting menu, you can configure the key bindings; the default ones are: .IP DOWN moves the tetromino down (one single step) .IP LEFT moves the tetromino left .IP RIGHT moves the tetromino right .IP SPACE rotates CW .IP UP rotates CCW .IP ENTER drops the tetromino as far down as possible (hard drop) .IP P pauses the game .IP CTRL+C exits the game without any further prompt .SH PLAYING MODES The game includes two playing modes. In the second one (harder), you do not get the preview of the next tetromino, and the algorithm is modified to take advantage of this. .SH FILES .I $(HOME)/.bastetrc User options .I $(HOME)/.bastetscores User-specific high scores file (used only if the system high scores file is unavailable) .I /var/games/bastet.scores2 System-wide high scores for bastet. .SH OPTIONS None. .SH BUGS Many. .SH AUTHOR Federico Poloni bastet-0.43.2/bastet.appdata.xml000066400000000000000000000022551257052537000165110ustar00rootroot00000000000000 bastet.desktop CC0-1.0 GPL-3.0+ Bastet Evil falling block game

Bastet (short for "Bastard Tetris") is a simple terminal-based falling block game equipped with an AI which computes how useful the bricks are and tries to give you the worst possible one.

Completing lines is significantly more difficult than in the usual game. Playing Bastet can be a painful experience at first, especially if you usually make "canyons" and wait for the long I-shaped block.

http://fph.altervista.org/prog/files/bastet043_menu.png http://fph.altervista.org/prog/files/bastet043_play.png http://fph.altervista.org/prog/bastet.html f.poloni_at_gmx.com
bastet-0.43.2/bastet.desktop000066400000000000000000000002711257052537000157450ustar00rootroot00000000000000[Desktop Entry] Type=Application Version=1.0 Name=bastet Comment=Evil falling block game Exec=bastet Icon=bastet Terminal=true Categories=Game;BlocksGame;ConsoleOnly; Keywords= tetris; bastet-0.43.2/bastet.png000066400000000000000000000036221257052537000150630ustar00rootroot00000000000000PNG  IHDR50+2sBIT|d pHYs S SqtEXtSoftwarewww.inkscape.org<IDAThlTU?o-awo5@DHclMP4DXB-dMSERqq7$0*1.Y4n#Z~cڙN?L;34]ww={yZ Ӻ3ah[Z %f.0 - h.@<4* - 7d d 7z C˟909W _z> 踄R!Sr+m\/ lu׈\J ]Wv(4P ;Exux()ܐ9 c:7鸳gRSҴQZ]W-c'l]WgEΉd dy//V` )]W4շr%45=p۶ ڜimM`2+8xn9irTcM{R!=lfx%SNxyrt?7ҥp8 nL>> غU G¢E};'{L]wAM TV 'O&sP] 6 }$/Wzj, 8ERH#Z%~Dc˯XO? /(PYhu ǤLzNkwǷEo$\>ܻW&I}AgY1;v:hkS@o937%a)x8nI\&y "k^<34Ū丫G4ڴBJG$H%­Jr R55p.*Ipg HMs!+b5K..g@+Ĵsr{ӍiTn]Ӎ47/Oj$MTwƤ$l YY}&WX@~%BW_ǡjg@VM}=D}Uh IENDB`bastet-0.43.2/bastet.svg000066400000000000000000000175121257052537000151010ustar00root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h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !hvIDAT !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h !h Ѩ O? 1 0 1UgP%6W c @B !@99c,H$h4  @B !@H$h4  @B 5O;IENDB`bastet-0.43.2/bastet043_play.png000066400000000000000000000444361257052537000163470ustar00rootroot00000000000000PNG  IHDR*9q pHYs  tIME IDATxi|YaSJ*[zߧg0Y&,-؎oLnv;`^6;NY  nm]UR{nIR:Uү_=oJ>54 @ z=DO'p8 @ z=DO'pK[͟|C~-o nJ'p8ك[f7<~*氂DO'p8 @ z=DO'p8 @ z=DO'p8B!QtTj qJ^25?T,fkoc[a;&tw ˞i\kh>ba:=pIǎl͛nGeKJ Qs |gzLGn ![otү(|}߶o,ӷJ wy9RM_{vҥL.ze9E'F>Ѳx tRV(g?=M^Ps)*pmOdh'շr Zџ9:ipwaޅ{Gpr"Gbkrͼ}'/, kR!$ml<{n=s'.zu7;޴su5zy`Z~i;GOֹ+D2GyzOfjcqabkgr޺SW6uGf3!P>rǚxogn"I/':_o?5;?̉w/cTeqb.P:37>~-yu!p`K~ȡ7Bamt7 $:ԻKB4B2ntoxʶ?U$x)7f!:s];S??T`>*=Be[.SK?]c4Әf\VZ(UZaE̡sd5ruǟ,jSsT:Ul̸.hxpv{d+iGn;WFC|;pv:]x/)PHөypS'6C職4L=??U !Tm蚼hf:b;ϗ_>Qh !d?;uCydrVCaj !;{mmP{vGh>;Ck[fQt۩?sz>у?v]j o&_ٸbk鎁O!Dh߸xy^|ɦBkl!$O ll!=''z?3ްv%mKFnK=0˻OF#;v>c!$Ox܉9ZT7,B}ƊWJzqU˻~+{L]%*s;/ %Mە![xC߱B3ݛ=S{Ndݠ4gEf˖W$Z?2}UܱK>r"kM_p%jyF Bvmd> L5vm۶>(lNQUX̯汷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Vp @z'p @z'p @z'p @zW6>mcߐsݿm뷟 9pwG-a'p @z'p @z'p @z'p @z'p @z'p @z'p @z'p @z'p @zeS苏~s{6c!=?s߸A=կnX~;&w@z'p @z'p @z'p @z'p @z'p @z'p @z'p @z'p @z'pM4 !o?ToG-a'p @z'p @z'p @z'p @z'p @z'p @z'p @z'p @z'p @zeS}|_}6Vɿ۶9#r߸᧶m&b'p @z'p @z'p @z'p @z'p @z'p @z'p @z'p @z'p @zeSE~MB"նmlXy`ƺ8 =HO8 =HO8 =HO8 =HO8 =HO8 =HO8 =HO8 =HO8 =Hl c7 ^O>pcG}߱#pHO8 =HO8 =HO8 =HO8ʦf}$pHO8 WVp @z'p @z'p @zcwIENDB`bastet-0.43.2/main.cpp000066400000000000000000000035241257052537000145240ustar00rootroot00000000000000/* Bastet - tetris clone with embedded bastard block chooser (c) 2005-2009 Federico Poloni minus 37 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "Ui.hpp" #include "Config.hpp" #include "BastetBlockChooser.hpp" #include //DBG #include #include using namespace Bastet; using namespace std; using namespace boost; using namespace boost::assign; int main(int argc, char **argv){ Ui ui; while(1){ int choice=ui.MenuDialog(list_of("Play! (normal version)")("Play! (harder version)")("View highscores")("Customize keys")("Quit")); switch(choice){ case 0:{ //ui.ChooseLevel(); BastetBlockChooser bc; ui.Play(&bc); ui.HandleHighScores(difficulty_normal); ui.ShowHighScores(difficulty_normal); } break; case 1:{ //ui.ChooseLevel(); NoPreviewBlockChooser bc; ui.Play(&bc); ui.HandleHighScores(difficulty_hard); ui.ShowHighScores(difficulty_hard); } break; case 2: ui.ShowHighScores(difficulty_normal); ui.ShowHighScores(difficulty_hard); break; case 3: ui.CustomizeKeys(); break; case 4: exit(0); break; } } }