Comments (4)
Sorry, it is a bit hard to follow the code - also my Python is not the best.
There is a way you can figure out what inputs you are getting though; you probably already tried to use something like print m
but whenever that line is executed it would throw back an error.
What you should do is try and figure out some properties of the matrix that is causing you to fail. If you were to put:
if (false)
print 'Hello World'
It would not throw an error because that line of code will never be executed. So what you can do is;
if (m.length == 1)
return NULL
This will cause all tests to fail where the map is a 1x1, see if you still have the same passing and failing tests as you did before.
If the same tests are failing then put;
if (m.length == 1)
print 'I will cause an error'
Now if you get an error when you run this, then you know that the failing test is a 1x1 matrix. You can do this for NxN matrix to figure out what is causing your code to fail.
My advice is that most people forget about the case where the matrix is 1x1 (already in terminal state) and 2x2.
from google-foobar-help.
I ran:
if len(m) == N:
return 0
or
if len(m) == N:
raise Exception("I will cause and error")
I cycled N from 0 through 10.
Using the return 0 I identified the length of every other test, and then using the "Exception" I was able to determine that the test I'm failing was not a unique length(unless it is longer than 10) test, i.e. I don't think my code has an issue with a specific size of matrix. I have the intuition that the test I'm failing involves a 10x10, but that's only based on tests 5 and 7-10 being 10x10.
I'm storing all of the numbers using the built in Fraction variable type which automatically handles the fraction reduction; I don't know if this could cause any issues with denominators being stored as signed 32-bit integer. I'm trying to think of other exception cases, but this is outside of my area of expertise.
You've been very helpful, thank you for your time!
If it helps at all, one of my previous attempts involved solving systems of multiple equations. The best I could do with that approach was passing 7/10 tests.
from google-foobar-help.
Mmm you could also test if that the Matrix at m[0]
is of terminal state. Meaning that the first state is the terminal state. It should be all zeros. If it is not that then maybe it is just how you are storing fractions. But check if m[0]
contains only 0s.
from google-foobar-help.
I still didn't pass test six, but detecting S0 as a terminal state was something that my code was not doing. It's probably for the best, classes are starting on Monday so I won't have time to fool around with the harder challenges anyway.
I appreciate all the help you have provided, especially the rundown on Markov Chains.
from google-foobar-help.
Related Issues (18)
- About doomsday_fuel challenge HOT 3
- Distract the guards HOT 6
- (I-Q)^-1 =? HOT 1
- Help wanted
- For test cases 3 and 10 f's columns do not match r's rows HOT 6
- How do you calculate inverse of matrix with fractions? HOT 2
- Add more Google Foobar Challenges!
- Some more to add (don't remember the names though)
- Solution to planning bunnies escape? HOT 1
- En Route Salute in one pass HOT 1
- doomsday_fuel issue HOT 1
- Distract the Trainers - Maximum Matching
- Two-layer Dijkstra solution for prepare_the_bunnies_escape HOT 3
- Help ? (doomsday_fuel) HOT 13
- t
- Doomsday Fuel Python Test 8 HOT 29
- doomsday_fuel tests HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-foobar-help.