Is it possible to write emacs dunnet game in solidity? Not that there is any reason for the game to be on a blockchain, it is for a class assignment. I tried 2048 game. But it seems to have some tricky code to be created in solidity. I could find the dunnet game but I am not sure if there is any place i can find the algorithm or design pattern for it. Please let me know if anyone knows about it.

  • >Please let me know if anyone knows about it. To answer your question: Yes, I know about it, as the author of the game. Apr 14 '19 at 3:49

This is a generic answer - I'm not going to try to implement any of the games you mentioned :)

The Ethereum virtual machine is Turing-complete (kind of) so you can write anything you want with it - all the algorithms are possible. You just need some language which gets converted into the bytecode which the EVM understand - Solidity is the most common one.

The reason why it's only kind of Turing-complete is that there are gas limits. A contract can only have certain size and a transaction (block) can only be of certain size. This (especially the latter restriction) basically means you can't run any fancy algorithms within Ethereum because you run to the block gas limit and the whole transaction gets reverted.

There are ways to go around these problems - for example split the algorithm run into multiple transactions and split your (too big) contract into multiple contracts/libraries. So if you use enough tricks you can, in theory at least, run any algorithms you want. Of course you have to pay a lot in gas fees for it then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.