Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
achiyae committed Jul 19, 2020
1 parent d1dce9b commit 8d85f4f
Show file tree
Hide file tree
Showing 151 changed files with 1,235 additions and 635 deletions.
247 changes: 247 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@

# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,pycharm
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode,pycharm

### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/**/sonarlint/

# SonarQube Plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

### VisualStudioCode Patch ###
# Ignore all local history of files
.history

# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,pycharm
139 changes: 139 additions & 0 deletions Examples/TTT.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
blockdiag {
initialization_code="

global X
X=lambda i: 'X'+str(i)

global O
O=lambda i: 'O'+str(i)

global anyX
anyX = (lambda e: e[0]=='X')

global anyMove
anyMove = (lambda e: anyX(e) or anyO(e))

global anyO
anyO = (lambda e: e[0]=='O')

global toX
toX = (lambda e: 'X' + e[1:])

global toO
toO = (lambda e: 'O' + e[1:])
"
event_selection_mechanism = "priority"

lines [type=start, initial="[
{'c1':1,'c2':2,'c3':3},
{'c1':4,'c2':5,'c3':6},
{'c1':7,'c2':8,'c3':9},
{'c1':1,'c2':4,'c3':7},
{'c1':2,'c2':5,'c3':8},
{'c1':3,'c2':6,'c3':9},
{'c1':1,'c2':5,'c3':9},
{'c1':3,'c2':5,'c3':7}]", width=350];
perm [type=permutation, keys="['c1','c2','c3']", width=200]

lines -> perm -> def_wt1 -> def_wt2 -> def_req;

def_wt1 [type=sync, wait="[X(c1)]", width=100, tokens_display="count only"]
def_wt2 [type=sync, wait="[X(c2)]", width=150, tokens_display="count only"]
def_req [type=sync, req="[O(c3)]", width=150, tokens_display="count only"]

########################################################################

perm -> ofn_wt1 -> ofn_wt2 -> ofn_req;
ofn_wt1 [type=sync, wait="[O(c1)]", width=100, tokens_display="count only"]
ofn_wt2 [type=sync, wait="[O(c2)]", width=150, tokens_display="count only"]
ofn_req [type=sync, req="[O(c2)]", priority=10, width=150, tokens_display="count only"]

########################################################################
perm -> owin_wt1 -> owin_wt2 -> owin_wt3 -> owin_req;

owin_wt1 [type=sync, wait="[O(c1)]", width=100, tokens_display="count only"]
owin_wt2 [type=sync, wait="[O(c2)]", width=150, tokens_display="count only"]
owin_wt3 [type=sync, wait="[O(c2)]", width=150, tokens_display="count only"]
owin_req [type=sync, req="['Player O wins']", block=anyMove, priority=100, width=150]

########################################################################

perm -> xwin_wt1 -> xwin_wt2 ->xwin_wt3 -> xwin_req;

xwin_wt1 [type=sync, wait="[X(c1)]", width=100, tokens_display="count only"]
xwin_wt2 [type=sync, wait="[X(c2)]", width=150, tokens_display="count only"]
xwin_wt3 [type=sync, wait="[X(c2)]", width=150, tokens_display="count only"]
xwin_req [type=sync, req="['Player X wins']", block=anyMove, priority=100, width=150]

########################################################################


tie_st -> tie_loop -> tie_wait -> tie_loop
tie_loop -> tie_req [label=after]


tie_st [type=start]
tie_loop [type=loop, count=9, width=200]
tie_wait [type=sync, wait=anyMove]
tie_req [type=sync, req="['No winner']", priority=100]


########################################################################

int_st -> int_1 -> int_2 -> int_1;

int_st [type=start]
int_1 [type=sync, wait=anyX, block=anyO, width=100]
int_2 [type=sync, wait=anyO, block=anyX, width=100]

###########

once_st -> once_wt -> once_bl
once_wt -> once_wt
once_st [type=start]
once_wt [type=sync, wait=anyMove]
once_bl [type=sync, block="[toX(event), toO(event)]", width=300, tokens_display="full with event"]


############

st -> rq1
st [type=start]
rq1 [type=sync, req="['O5']", priority="-1"]

st -> rq2 -> rq2
rq2 [type=sync, req="['O1','O3','O7','O9']", priority="-2", width=200]

st -> rq3 -> rq3
rq3 [type=sync, req="['O2','O4','O6','O8']", priority="-3", width=200]



run="
run_init(diagram)
setup_diagram(diagram)

print_state(False)

board = [' ' for i in range(9)]

while True:
while step_to_next_state(diagram): print_state(False)

try:
e = select_event(diagram)
except:
e = 'X'+input('Enter cell number to put X in:')

if e[0] in ['O','X'] and e[1] in ['1','2','3','4','5','6','7','8','9']:
board[int(e[1])-1] = e[0]
print( '\n-----\n'.join([ '|'.join(board[i*3:(i+1)*3]) for i in range(3)]))
print()
wake_up_tokens(diagram, e)
else:
print('Game ended: ' + e)
break
"


}
Binary file added Examples/TTT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8d85f4f

Please sign in to comment.