Home > Shuffly-Brain

Shuffly-Brain

Shuffly-Brain is a project mainly written in C#, it's free.

The core of the shuffly system, compiler and virtual machine for the spoke language.

Any Card Game codename Shuff.ly As described by Dested

Information

  1. Web Front End (The Game)
  2. Javascript?
  3. Extremely lightweight in appearance.
  4. Floating windows above a constantly running gameboard
  5. (see image warning: ugly)
  6. Developer Front End
  7. Javascript?
  8. Support for pushing code to the test server to compile
  9. Compilations will be queued and returned results when finished.
  10. Allow to test run the game against our Test server.
  11. Allow for developer step through code and simulate player responses
  12. Submit a game to be released to Beta
  13. Still reviewed for terrible things
  14. Allow users to click into a beta area to see and play beta game
  15. Move game to release mode
  16. Supports ad profit sharing
  17. Percentage? Im thinking 35%?
  18. Monitoring of the released games, being able to see play percentages, bounce rate, ad money, bug reports?, and upload custom card images
  19. Web Server Backend
  20. There will need to be a webserver almost certainly to track the developer side of things, including profit sharing and monitoring of statistics.
  21. Im thinknig asp.net, potentially asp.net MVC but ive never personally used it. I just know for a fact its wonderful.
  22. Is there need for a web server for the front end?
  23. Lightweight custom Long Polling type server to allow for constant easy communication between clients and brain.
  24. The brain will also be responsible for compiling the Spoke language and running its virtual machine.
  25. Running of the spoke games can happen in a few ways, each with their own gains and losses
  26. Save the entire current state of the game on question request to be loaded up and some how resumed on player response.
  27. Doing it this way may be space costly but could open the door to different kinds of games, for instance those that take place over long periods of time
  28. Spoke Language
  29. The specification can be found here.
  30. The language will come with a card game framework to allow for easy game making, as described here.
  31. Card Games
  32. The first thing the developer should do is instantiate the CardGame object with the number of cards the game will be played with, and the number of jokers.
  33. The number of cards can only be a multiple of 52 currently
  34. The CardGame object will contain all the users playing in the game and the cards they hold, along with all of the Piles being used in the game and the Table objects for drawing purposes.
  35. Most games then enter into a loop that is only broken when the game is finished, as normally the logic for card games is something like loop through each player forever until some condition is met.
  36. In this loop the developer will do things like pose players questions as to how he would like to progress the game, be it move a card from one pile to another(ex. discarding) , or simply ask a question pertaining to logic (go fish?)
  37. When these questions are asked the game is halted until the player has answered. There are configuration settings that can define the maximum wait time.
  38. You can also define a question to be posed to more than one player, and even different possible answers for each player. The separate responses can then be looped through and handled accordingly.

Spoke Specification

  1. Structure

  2. Code is structured in a strict tabbed format

  3. Classes and Enums are always at tab index 0

  4. Methods defintions are always at tab index 1 and method content are always at tab index 2

  5. Code blocks are denoted by increased tab index

  6. Keywords

  7. def,class,create,switch,enum,return,static,this,if,else,false,true

  8. Operators

  9. Arithmetic

      • / * % ^
  10. Logical

  11. && || !

  12. Increment, Decrement

  13. ++ --

  14. Relational

  15. == != < > <= >=

  16. Assignment

  17. = += -= *= /=

  18. Field access

  19. .

  20. Anonymous method

  21. =>

  22. Indexing arrays

  23. [ ]

  24. Ternary conditional

  25. bool?val1:val2

  26. Both values must be of equal type

  27. Object creation

  28. create

  29. Literals

  30. float

  31. 1.4,-402.4234

  32. int

  33. 1,5,80,-120

  34. string

  35. \

  36. bool

  37. true,false

  38. Arrays

  39. Arrays are instantiated by simply using [] and can contain any number of values as long as they are of the same type

  40. a=[]

  41. a=[1,3,5,8]

  42. a=[create {X=5,Y=10},create {X=12,Y=15}]

  43. Arrays have a full list of methods to allow manipulation, some of which have compiler instruction calls tied to them (Add, Remove, GetElement, SetElement)

  44. Classes

  45. Classes have a case sensitive name

  46. class ClassName

  47. They are made up of Fields and Methods

  48. Fields are defined simply as name=value, and must be assigned a default value

  49. Foo=create Bar()

  50. Amount=0.0

  51. Methods are defined as def name(paramaters)

  52. def Foobar(foo,bar) print(foo) print(bar)

  53. Static methods have type information along with them

  54. def static Foobar(int foo,int bar)

  55. Methods are not polymorphic

  56. Objects

  57. An object can be a predefined class with methods and fields, or defined at time of use with only fields. Class instantiation can also take any number of parameters defined in the constructor.

  58. create Foobar(15) , create {Foo=6,Bar=9}

  59. Objects are considered of the same type so long as they contain the same field thumbprint (defined as type and name)

  60. An object can be set to null, but an object cannot be set to null initially.

  61. To set an object to null while still defining the type use

  62. type Foobar , type {Foo=type int, Bar=type int}

  63. Only objects of the same type can be compared

  64. if create {X=5,Y=12}==create {X=5,Y=11} # will compile

  65. if create {X=5,Y=12}==create {X=5,Y=11,Z=12} # will not compile

  66. Methods

  67. Methods can be called on an object using dot notation. Inside of methods the developer is allowed to use the special variable this to denote the current object.

  68. variable.someMethod(6)

  69. this.someMethod(6)

  70. someMethod(6) # from within the same class

  71. Static methods do not allow this and are called by using the class name

  72. Foobar.someMethod(6)

  73. Variables

  74. Variable Naming

  75. Case Sensitive

  76. Cannot start with number

  77. Cannot be keywords

  78. Variables types are defined at the time of instantiation, its type cannot change through the lifetime of the application

  79. Types

  80. int, float,bool,array, an object

  81. Variable types only need to be defined in the the header of static methods, they are assumed by declaration after that point

  82. Anonymous Methods

  83. Anonymous methods are denoted using =>, parameters are only used when neccecary

  84. variable => |(parameter1,parameter2)

    CodeBlock

  85. They are used for loops as well as passing around chunks of code.

  86. Loop

  87. Loops can be triggered on by either a boolean conditional (traditional while loop), or an array (traditionally foreach loop)

  88. [1,2,4,6]=>|(value) print(value) # 1 2 4 6

  89. [1,2,4,6]=>|(value,index) print(index) # 0 1 2 3 print(value) # 1 2 4 6

  90. [1,2,4,6]=>variable # where variable is an anonymous # method with thethumbprint of one or # two int parameters

  91. They can be set to variables. When doing this they maintain the variable scope in which they were declared.

  92. variable = |(value,index)=> print(value) print(index)

  93. Conditional structures

  94. If statement (with optional else and else if)

  95. if i==3

    code block

    else if i==5

    code block

    else

    code block

  96. Ternary

  97. variable = (i==3)?12:19

  98. Switch structures

  99. switched on variables can be of any type.

  100. fall through is not allowed unless the codeblock is empty

  101. switch (variable) case 1:

    code block

     case 2:
             #code block
     case 3:
     case 4:
             #code block        
  102. Enums

  103. Enum items can be set to a value of any type

  104. Enum Priority High=1 Medium=2 Low=3

Library definition

Package SpokeLibrary

Class Rectangle int x int y int width int height

Class Randomizer (int seed) int next() int nextBetween(int left,int right)

Class Math float pi float sin(float s) float cos(float s) float tan(float s)

Class Array void add(Any object) void addRange(Any[] objects) void remove(Any object) bool contains(Any object) int length() Any elementAt(int index) void setElement(int index,Any object) int indexOf(Any object) void clear()

Enum Order NoOrder,Ascending,Descending

Package ACGFramework

Class CardGame (int numberOfCards, int numberOfJokers) User[] users Pile[] piles Pile deck TableArea mainArea TableArea[] userAreas void dealCards(int numberOfCards,CardState state)

Class User string userName int playerDealingOrder Card[] cards

Class Pile Card[] cards void shuffle()

Class Card int value CardType type bool faceUp CardState state String getFullName() String getValueName() String getTypeName()

Enum CardState FaceUp,FaceDown,FaceUpIfOwned

Enum CardType Heart,Diamond,Spade,Club

Class PokerRules PokerResult[] evaluatePoker(Cards[] cards)

Class PokerResult Card[] cards PokerWinType type int weight

Enum PokerWinType Straight,Flush,Pair,ThreeOfAKind,FourOfAKind,StraightFlush

Package LayoutFramework

Class TableArea int numberOfCardsHorizontal int numberOfCardsVertical Rectangle dimensions TableSpace[] spaces TableTextArea[] textAreas

Class TableSpace bool visible bool stackCards bool drawCardsBent string name string areaName int xPosition int yPosition int width int height Order sortOrder

Class TableTextArea string name string areaName int xPosition int yPosition int rotateAngle string text

Previous:python-play