Code Monkey home page Code Monkey logo

euclidthegame's Introduction

Euclid The Game

The goal of this project is to gamify geometric challanges. We use the geogebra software for this. This game is MIT licensed, see the LICENSE file.

See the facebook group for updates about the iOS game: https://www.facebook.com/euclidthegame

Message July 2014

A year ago I posted the idea for this game at stackexchange: http://math.stackexchange.com/questions/373672/about-euclids-elements-and-modern-video-games

I hoped that I could inspire game developers to make such a game. Well, I failed ! But I did inspire myself to learn a little bit about html/javascript and geogebra, and in this way, I was able to make this game.

If you have worked with geogebra, it may be not so hard to contribute to new levels. I've written a couple of function that make it easy to test if objects/lines/circles are drawn:

function ggbOnInit() {
  ggbApplet.debug("ggbOnInit");
  ggbApplet.registerAddListener("newObjectListener");
}

function newObjectListener(obj) {
  // this functions can check all general objects
  function checkobject(target, step) {
    if (obj != "finished") {
      var cmd = "finished = (" + obj + "== " + target + ")";
      ggbApplet.debug(cmd);
      ggbApplet.evalCommand(cmd);
      finished = ggbApplet.getValueString("finished");
      if (finished.indexOf("true") > -1) {
        ggbApplet.setVisible(step, true);
      }
    }
  }
  // this functions check line segments
  function checksegment(target, step) {
    if (ggbApplet.getObjectType(obj) == "segment") {
      //gives beginpoint and enpoint of object
      var objectcmd = ggbApplet.getCommandString(obj);
	  var openbracket = objectcmd.indexOf('[') + 1;
	  var comma = objectcmd.indexOf(',');
	  var closebracket = objectcmd.indexOf(']');
	  var beginpointobject = objectcmd.substring(openbracket, comma);
	  var endpointobject = objectcmd.substring(comma + 1, closebracket);
      //gives beginpoint and endpoint of target
      var targetcmd = ggbApplet.getCommandString(target); 
	  var openbracket = targetcmd.indexOf('[') + 1;
	  var comma = targetcmd.indexOf(',');
	  var closebracket = targetcmd.indexOf(']');
	  var beginpointtarget = targetcmd.substring(openbracket, comma);
	  var endpointtarget = targetcmd.substring(comma + 1, closebracket);
      //here it checks if endpoints of line segment are equal
      if (obj != "finished") {
        var cmd = "finished =((("+beginpointobject+"=="+beginpointtarget+")||("+beginpointobject+"=="+endpointtarget+"))&&(("+endpointobject+"=="+beginpointtarget+")||("+endpointobject+"=="+endpointtarget+")))";
        ggbApplet.debug(cmd);
        ggbApplet.evalCommand(cmd);
        finished = ggbApplet.getValueString("finished");
        if (finished.indexOf("true") > -1) {
          ggbApplet.setVisible(step, true);
        }
      }
    }
  }
   // this functions can check if line segment has right direction
  function checksegmentdirection(target, step) {
    if (ggbApplet.getObjectType(obj) == "segment" || ggbApplet.getObjectType(obj) == "line") {
    if (obj != "finished") {
      var cmd = "finished = (("+obj+"(1)=="+target+"(1))&&("+obj+"(-1)=="+target+"(-1)))";
      ggbApplet.debug(cmd);
      ggbApplet.evalCommand(cmd);
      finished = ggbApplet.getValueString("finished");
      if (finished.indexOf("true") > -1) {
        ggbApplet.setVisible(step, true);
      }
    }
  }
  }
  // this functions check if the new point is on the targetline
  function checkpointontarget(target, step) {
    if (ggbApplet.getObjectType(obj) == "point") {
    if (obj != "finished") {
      var cmd = "finished = ("+target+"(x("+obj+"))==y("+obj+"))";
      ggbApplet.debug(cmd);
      ggbApplet.evalCommand(cmd);
      finished = ggbApplet.getValueString("finished");
      if (finished.indexOf("true") > -1) {
        ggbApplet.setVisible(step, true);
      }
    }
  }
  }
  //here you can check all objects 


  //which step are neccesary to complete level
  if (ggbApplet.getVisible("step1") ) {
    ggbApplet.setVisible("complete", true);
	document.getElementById("level").style.visibility="visible";
  }
}

euclidthegame's People

Contributors

cono avatar denilsonsa avatar fornever avatar kasperpeulen avatar mhartl avatar seragunn 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  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  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

euclidthegame's Issues

UI improvements

How can I impove the UI ?

I'm testing this version now:
http://euclidthegame.org/Level1anew.html

Let me know what you think.

Featuers:

  • zooming in and out
  • hide objects with right click
  • being able to drag lines and circles
  • use no dropdown menu in toolbar (better for mobile phones)

Correct solutions for level 2 and 3 are not recognized

Circle AB intersects the other ray at C. Then bisect line segment BC by drawing circles centered on B and C. This bisects BC at point D. Ray AD bisects the angle. This solution is not recognized.

My approach for bisecting a line segment in level 2 is also not accepted as an answer to level 3. IMO this is a pretty fundamental solution since it only uses circles and lines. As others have said, this also suggests that level 3 is easier than level 2.

Possible Solution for #2

I constructed an equilateral triangle, then made a circle centered at D, increasing the radius until segment AB was tangent. The resulting intersection should be the midpoint of segment AB.

level2

Unaccepted answer on 5

Compass between AB and BA,
Intersect the intersections
and connect
them.

Then, between them, a line.
Now the half and upwards.
But no :(

screenshot 2014-06-21 00 55 01

intersection tool bug

The intersection tool doesn't seem to work when one of the two intersecting lines is overlapped by an other line.

This issue can be fixed by using the intersecting tool in an other way. Which is explained in the tutorial.

Something that could partly fix this issue is checking if a new object is already drawn, if so, then remove/hide the new object, so that it won't overlap existing lines/circles etc.

Level 11 misleading coincidence

As seen in the image, creating a perpendicular line to AB through D results in a line that appears as if it passes through point A. This is just coincidence, and it's terribly misleading. I have seen one solution which starts like this, and it makes it really confusing to look at.

An easy fix would be to move A, B, and C slightly to the right.

image

writing new ray checking function

I should write a new ray checking function I guess.
One that only wants the ray to have the right direction.

I already have such a function for line segments:


function checksegmentdirection(target, step) {
if (ggbApplet.getObjectType(obj) == "segment") {
if (obj != "finished") {
var cmd = "finished = (("+obj+"(1)=="+target+"(1))&&("+obj+"(-1)=="+target+"(-1)))";
ggbApplet.debug(cmd);
ggbApplet.evalCommand(cmd);
finished = ggbApplet.getValueString("finished");
if (finished.indexOf("true") > -1) {
ggbApplet.setVisible(step, true);
}
}
}


I'm thinking about writing a similar function for rays. It's probably not that difficult, but I wrote all those codes a year ago, so I don't really understand what I'm doing.

Level Select once Problem Set is completed.

Might be a cool thing to add or allow a level select at Level 20 (or at the end of each completed set of tasks), once complete, for those who wish to go back and try old challenges with new skills.

Level 4 description is ambiguous

The level 4 description is "Level 4: Construct a line (segment) perpendicular to the given line segment that goes through point A".

I parsed this to mean "(construct a line segment) perpendicular to (the given line segment that goes through point A)", but instead it is "(construct a line segment that goes through point A) perpendicular to (the given line segment)."

Suggest: optimize compass2

The tool compass2 requires there is a line segment whose distance is used as the radius.

I believe that many people will make mistakes when there is a line through the two points but not from the one to another, because the coincide lines is really hard to distinguished from only one.

It will be better to make it work with no explicit segments, just using the distance as the radius.

Or maybe, it can be more friendly, to use a list to show which objects exist at present.

iOS port

Hi,

I really enjoyed your game and I think it would be great to port it to iOS).

As we are a group of people dedicated to teaching other people mathematics and technical sciences, and I personally think that making such game would fit very well with our values.

I'd like to ask your permission to do that, as the game would be based on your idea. We could also work together on UI to the html version.

Please contact me at: [email protected]

Competitive Feature Suggestion

I had a suggestion for a way to make the game a little more competitive. I've seen other games that track time spent or number of steps used to reach a solution, which creates an impulse in the player to improve on their own skills or best someone else's. And doesn't preclude the possibility of multiple solutions to the each level.

I'm sure this a "down-the-road" type of implementation, but I do feel it would (when coupled with a solution spoiler mask in the comments) provide more challenge, while encouraging plenty of replay and return visits.

Thanks for the great first run though. Really impressed!
AC

undo/redo button problem

As benjamin worded in the comments of level 1:

Having the Undo button slide over when clicked so that the Redo button is now under the mouse is a poor UX. If I want to undo multiple actions, I would, as a user, assume that the undo button will not move, and will click several times without moving my mouse.

This does not have the intended effect though, as what actually happens, is the Redo button appears under the mouse, and I flip back and forth on those two buttons.

Better is to always show the Redo button, but gray it out (as it does before it slides away) when there are no Redos possible."

This defintely needs to be fixed. It's part of the geogebra software, and there is definitely no easy way to fix this. I've reported it to geogebra as being the number 1 complaint I get.

It may be possible to create some hack to fix this, but I'm not sure. In the meantime, users can use crtl-z and crtl-y.

Level 11 "Well Done" that makes no sense

Steps to recreate:

  1. Compass2 - A, C, D
  2. Intersect - J
  3. Triangle - D, J

The result is a Well Done for the resulting triangle/point K. I have looked a lot at this, and I can't figure out how this brings you any closer to the solution.

image

being able to save and continue on other time (log in system?)

As Alexandru Carlan reported:

You definitely need to include a way to save and continue another time. A system of accounts, with login, maybe?

That would be definitely cool, but I don't know how to make a log in system. At this time the game runs on neocities.org. I probably would need to learn php or something like that to make this.

In the meantime a user can make a bookmark of the level he is in, and continue from this bookmarkt the next time.

Level 20 not accepted

Hi, I tried a bunch of mutations of this one, and I'm fairly certain this should be the answer, but I can't get it to be accepted:

level_20

Am I just wrong and is this line just coincidentily very near tangential?

Translate a segment tool bug

In problem 18 I wanted to start with translating segment AB to point B (Making it twice as longer).
But it's impossible with translate a segment tool. When you select 2 points and click on B again to select it as a starting point for the new segment, nothing happens.

reloading changed tools on level 2

i left the game at L2 on Safari@iPad opening other apps on iPad. When I went back to Safari, and the L2 loaded again, I suddenly had more tools that I did not have before, e.g. a dot inside an area. i think in total there were 2 more tools.

Spoiler Free Mode

Hi, this is a terrific game and thanks for making it. I'd love to share it with my little brother, but I feel the temptation of comments with answers showing up without even having to scroll down might tempt him too much.

I'm trying to think of a good way to do this. Ideally the new url would look inconspicuous, maybe something like this:

http://euclidthegame/a/level1.html

I can't think of a way to do this without making a new directory and duplicating pages. Any ideas?

Level 20 won't accept correct solution (spoiler)

Not sure how to describe my solution, so I'll try to be super verbose. My steps:

  1. Create line segment A, B: l1
  2. Create line perpendicular to l1 that goes through B: l2
  3. Create line perpendicular to l1 that goes through A: l3
  4. Create point at the intersection of top of circle A and l3: N
  5. Create point at the intersection of bottom of circle A and l3: M
  6. Create point at the intersection of top of circle B and l2: P
  7. Create point at the intersection of bottom of circle B and l2: O
  8. Draw ray P, N->: r1
  9. Draw ray O, M->: r2
  10. Find point r1, r2: Q
  11. draw circle origin Q with a radius of Q, B (use B because we have a little extra space for the points
  12. Find intersecting points of circle B and circle Q: S and R
  13. line segments Q, S and Q, R are external tangets to circle A and circle B

some bug on level 3

Sometimes,when complete level 3,it will show "Level 2 Complete!" ,so the player can't resume.

Suggest: simplify the operations of compass2

The tool compass2 requires there is a line segment whose distance is used as the radius.

I believe that many people will make mistakes when there is a line through the two points but not from the one to another, because the coincide lines is really hard to distinguished from only one.

It will be better to make it work with no explicit segments, just using the distance as the radius.

Or maybe, it can be more friendly, to use a list to show which objects exist at present.

Invalid Solution on 14

I think this is valid... find the center of the triangle at the intersection of the bisections, then create a circle with the radius of the shortest leg.

screen shot 2014-06-20 at 5 47 27 pm

JS Version for Devices

I'd LOVE to take this game on the go - flex my spacial brain on my morning commute. I'm curious if there is any interest in developing a JS version of game targeting multiple devices.

If you (or anyone) is piqued in helping with the math, lessons, theory sort of stuff, I'd be willing to work on a port of your game into js, html5, etc!

[email protected] ;)

Some suggestions

  1. Zooming in and out, moving canvas around (I bet this is on the go)
  2. Shortcuts
  3. Recognise existing named nodes and avoid naming it again when using intersecting (uselessly) or using compass with one as the second point
  4. Esc to cancel the current operation, dismissing selected points
  5. More difficult levels (hopefully)

Thanks and this game is awesome. :)

Unaccepted answer for level 6

Construct a circle centred on C and going through A.
Construct the line AC and find its other intersection with the circle, D.
Construct the midpoint between D and B, E.
Line CE is parallel to AB (checked in GeoGebra).

level6

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.