Code Monkey home page Code Monkey logo

matris's People

Contributors

jringram avatar uglemat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

matris's Issues

Having issues with an AI placing tetrominos

Hi Uglemat,

Sorry if this is the wrong place to post a question.

I'm trying to place Tetrominoes through an AI agent I'm creating for a project.

At the moment I'm just trying to implement a random placing of pieces) but I'm struggling to place them.

I've created my own representation of the board, which the agent uses to judge where is a placeable location.

Say the board already had the following block placed in the bottom corner:

[O,X,O]
[O,X,O]
[X,X,O]

And the block had been rotated once in the bottom corner, the board representation would show as the following:

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0]

My random agent then looks for potential valid placements and concludes that an 'S' block could be rotated twice to produce:

[0, 0, 0]
[0, 1, 1]
[1, 1, 0]

And concludes that it can be placed in column 5 at height 21 to produce the following board:

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 0, 0, 0, 0, 0, 1, 1, 0, 0]
[1, 1, 1, 0, 0, 1, 1, 0, 0, 0]

To try and get the board to place this here, I use the following commands:

(tetromino_placement[1],tetromino_placement[2])
self.tetromino_position = (y_axis_value,x_axis_value)
self.tetromino_rotation = 2

I was expecting this to work, however I get the following errors:

Traceback (most recent call last):
  File "/home/JRINGRAM//.p2/pool/plugins/org.python.pydev.core_7.0.3.201811082356/pysrc/pydevd.py", line 1951, in <module>
    main()
  File "/home/JRINGRAM//.p2/pool/plugins/org.python.pydev.core_7.0.3.201811082356/pysrc/pydevd.py", line 1945, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/home/JRINGRAM//.p2/pool/plugins/org.python.pydev.core_7.0.3.201811082356/pysrc/pydevd.py", line 1305, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
  File "/home/JRINGRAM//.p2/pool/plugins/org.python.pydev.core_7.0.3.201811082356/pysrc/pydevd.py", line 1312, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/JRINGRAM//.p2/pool/plugins/org.python.pydev.core_7.0.3.201811082356/pysrc/_pydev_imps/_pydev_execfile.py", line 25, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/JRINGRAM//MaTris/matris.py", line 655, in <module>
    Menu().main(screen)
  File "/home/JRINGRAM//MaTris/matris.py", line 606, in main
    menu.update(events, timepassed)
  File "/home/JRINGRAM//MaTris/kezmenu/kezmenu.py", line 127, in update
    self.options[self.option]['callable']()
  File "/home/JRINGRAM//MaTris/matris.py", line 586, in <lambda>
    ['Play!', lambda: Game().main(screen)],
  File "/home/JRINGRAM//MaTris/matris.py", line 500, in main
    self.redraw()
  File "/home/JRINGRAM//MaTris/matris.py", line 513, in redraw
    self.matris.draw_surface()
  File "/home/JRINGRAM//MaTris/matris.py", line 205, in draw_surface
    if with_tetromino[(y,x)] is None:
TypeError: 'bool' object is not subscriptable

I don't suppose you have any idea what's causing this? I think it's an error with drawing the shadows, but I can't quite work out what exactly is causing it?

Do you know how other academic projects using this have controlled an agent placing the blocks?

Many thanks in advance!

start screen looks weird on a mac

pygame 2.0.3 (SDL 2.0.16, Python 3.5.2)

MacOS mojave

I'm able to play the game by clicking the top left button. But when I click any other button the game exits.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.