Dagaz: The End of Solitude

Happiness for all, for nothing

and let no one go offended!



A. and B. Strugatsky "Picnic on the sidelines"





Bots, no matter how good they play, are a poor substitute for live players. If the bot plays poorly - this is not interesting. If it’s strong, it’s insulting and again not interesting. It’s hard to keep the balance (especially since it’s individual for each player). For a long time I was going to implement a network game, but everything rested on the need to maintain my own server. Fortunately, the decision came from an unexpected angle.



Ed van Zon is a person I have been in touch with for quite some time. It so happened that it was he who picked up the falling Zillions banner when the developers (Jeff Mallett and Mark Lefler) suddenly lost interest in the development of the project. So, all these games are published on the site by his forces. And yet, he and Christian Freeling are engaged in the support and development of his own site (of course, also about board games):









But all this was a saying. The tale begins with the fact that on this site there is a hole (or rather, a hole , but this is not the point), in which live players can play by correspondence. Rather, they could, until the technology of Java applets was considered obsolete. Recently, as their use by mere mortals has become difficult, Ed has been thinking about more modern solutions. And then I turned up, along with my project .









After a very short training tour, for my part, Ed, for literally a couple of months, set up three dozen new games on the Dagaz engine and posted them on the site. Let me remind you that the MIT license (like myself), supports such actions in every way.



There was, however, one problem.
It was understood that players could play all these games among themselves, and not just with bots, but Dagaz, in its initial implementation, did not provide such an opportunity. I had to quickly come up with something. Fortunately, I already had a session-manager that allowed me to roll back mistakenly made moves. As a bonus, he saved the history of the game in RAM and it was decided to use this.



Preservation
SessionManager.prototype.save = function() { if (_.isUndefined(this.current) || _.isUndefined(this.current.board)) return null; var states = []; var board = this.current.board; while (board.parent !== null) { states.push(board); board = board.parent; } var r = "("; while (states.length > 0) { var board = states.pop(); r = r + ";" + Dagaz.Model.playerToString(board.parent.player); r = r + "[" + Dagaz.Model.moveToString(board.move) + "]"; } r = r + ")"; return r; }
      
      





and loading
 SessionManager.prototype.load = function(sgf) { var res = Dagaz.Model.parseSgf(sgf); this.states = []; delete this.current; var board = Dagaz.Model.getInitBoard(); this.addState(Dagaz.Model.createMove(), board); for (var i = 0; i < res.length; i++) { var p = res[i].name; if (p != Dagaz.Model.playerToString(board.player)) return false; if (res[i].arg.length != 1) return false; var move = this.locateMove(board, res[i].arg[0]); if (move === null) return false; board = board.apply(move); this.addState(move, board); } this.controller.setBoard(board); return true; }
      
      





They did it just a few dozen lines (I certainly do not think the SGF format parser itself, anyone can see it here ). By the way, both SGF and session-manager themselves support working with a tree, and not just with the game history, but for our current purposes this was not required.



As the first game from Dagaz, with the possibility of playing on the net, I wanted to choose something original (especially since Ed already had Checkers , Chess and Go ). The choice fell on Turnover . This game, in many ways similar to Chess, was recently invented by LĂșcio JosĂ© PatrocĂ­nio Filho.





The figures here are prefabricated. The largest ring moves like a chess pawn , the middle one like an elephant , and the core is a rook . The combination of the rook and the bishop gives the queen (which is quite logical), and the two rings give the chess knight . All three parts together form a castle - the main figure that needs to be protected. It is worth saying here that only one, the most external part, always moves. Thus, the outer ring of the castle, at any moment, can move with the pawn (including a jump through the field), but the castle will be destroyed.



There is another problem that has not yet been resolved.
Having lost the last castle, the player loses. In fact, the player cannot lose all the locks, since the game has the rules of check and checkmate . Castles are not allowed to be left under attack, but only on condition that they are all attacked. In addition, the intrigue in the game is added by the fact that new figures (and castles too) can be created from components along the way (including from the opponent’s material). All this makes checking for check and checkmate a very difficult task and here is an example with which she still can not cope:









In fact, there is no mat, but it is quite difficult. Field D1 is attacked by an elephant on E2 and this is the last castle. The gold ones can build a second castle by stepping the rook from C3 to C4, but this field is also attacked! The trick is that both fields are attacked by the same figure, and she cannot eat both locks in one go! LĂșcio discovered this error recently and this is something that I will work on in the near future.



There is no castling and taking on the aisle in the game, and indeed, Turnover is not very similar to Chess. There are a lot of kings in the game, but they cannot move (in any case, without destruction), and the horses and queens are “disposable”, since moving, the outer ring destroys the figure. In my opinion, the game looks quite interesting, although not completely explored. You can play here:





To play on the network, of course, you will need to register (the game is by correspondence) and send someone a “Challenge”. If you want to play with the bot (or just move pieces on the board ), no registration is required. However, in this mode, the game will not differ much from that published on GitHub . Also, registration is not required to monitor current or previously played games.



As a bonus
Dagaz supports another game mode:





So, those who wish can try to play blindly (this time, only against the bot).



Turnover wins / losses are not yet kept, but everything is in your hands. If the game is popular, Ed promised to tie a rating to it. And finally, a small poll on the topic of further development of the project:




All Articles